webledger-auth-plugin 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ declare module '@ioc:AuthService' {
14
14
  forgotPin(uuid: string, password: string, user_pin: string): Promise<any>;
15
15
  logoutURL(): string;
16
16
  checkLoginURL(): string;
17
+ forgotPasswordMobile(params: any): Promise<any>;
17
18
  }
18
19
  const authService: AuthServiceI;
19
20
  export default authService;
@@ -64,6 +64,7 @@ export default class AuthService implements AuthServiceI {
64
64
  resendEmailVerification(email: string): Promise<import("axios").AxiosResponse<any, any>>;
65
65
  verifyPin(uuid: string, user_pin: string): Promise<import("axios").AxiosResponse<any, any>>;
66
66
  forgotPin(uuid: string, password: string, user_pin: string): Promise<import("axios").AxiosResponse<any, any>>;
67
+ forgotPasswordMobile(params: any): Promise<import("axios").AxiosResponse<any, any>>;
67
68
  logoutURL(): string;
68
69
  checkLoginURL(): string;
69
70
  }
@@ -18,6 +18,7 @@ class AuthService {
18
18
  resend_email_verification: '/api/resend_verify_email',
19
19
  verify_pin: '/api/users',
20
20
  forgot_pin: '/api/users',
21
+ forgot_password_mobile: '/api/forgot_password_mobile',
21
22
  };
22
23
  this.client = axios_1.default.create({ baseURL: config.host });
23
24
  this.client.defaults.timeout = config.timeout || 30000; // default is 30seconds
@@ -31,6 +32,8 @@ class AuthService {
31
32
  for (const key in headers) {
32
33
  this.client.defaults.headers.common[key] = headers[key];
33
34
  }
35
+ this.client.defaults.headers.common['x-product-type'] = config.product;
36
+ this.client.defaults.headers.common['x-auth-env'] = config.env;
34
37
  this.paths = { ...this.paths, ...config.paths };
35
38
  }
36
39
  createToken(sub) {
@@ -155,6 +158,11 @@ class AuthService {
155
158
  this.setAuthToken(subject);
156
159
  return this.client.post(`${this.paths[subject]}/${uuid}/forgot_pin`, { password, user_pin });
157
160
  }
161
+ forgotPasswordMobile(params) {
162
+ const subject = 'forgot_password_mobile';
163
+ this.setAuthToken(subject);
164
+ return this.client.post(this.paths[subject], params);
165
+ }
158
166
  logoutURL() {
159
167
  const url = `${this.config.host}/sso/${this.config.env}/logout?product=${this.config.product}`;
160
168
  return url;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webledger-auth-plugin",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "webledger auth service AdonisJS 5 login plugin",
5
5
  "main": "build/providers/AuthServiceProvider.js",
6
6
  "scripts": {