propro-utils 1.5.79 → 1.5.81
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.
- package/package.json +1 -1
- package/src/server/index.js +46 -1
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -76,6 +76,9 @@ class AuthMiddleware {
|
|
|
76
76
|
authValidation(['user']),
|
|
77
77
|
this.handleAppSettings
|
|
78
78
|
);
|
|
79
|
+
this.router.post('/api/forgot-password', this.handleForgotPassword);
|
|
80
|
+
this.router.post('/api/verify-reset-code', this.handleVerifyResetCode);
|
|
81
|
+
this.router.post('/api/reset-password', this.handleResetPassword);
|
|
79
82
|
}
|
|
80
83
|
|
|
81
84
|
handleAuth = (req, res) => {
|
|
@@ -342,7 +345,10 @@ class AuthMiddleware {
|
|
|
342
345
|
return (
|
|
343
346
|
!path.includes('/api/v1/auth/login') &&
|
|
344
347
|
!path.includes('/api/v1/auth/signup') &&
|
|
345
|
-
!path.includes('/api/v1/auth/send-magic-link')
|
|
348
|
+
!path.includes('/api/v1/auth/send-magic-link') &&
|
|
349
|
+
!path.includes('/api/v1/auth/forgot-password') &&
|
|
350
|
+
!path.includes('/api/v1/auth/verify-reset-code') &&
|
|
351
|
+
!path.includes('/api/v1/auth/reset-password')
|
|
346
352
|
);
|
|
347
353
|
};
|
|
348
354
|
|
|
@@ -445,6 +451,45 @@ class AuthMiddleware {
|
|
|
445
451
|
}
|
|
446
452
|
};
|
|
447
453
|
|
|
454
|
+
handleForgotPassword = async (req, res) => {
|
|
455
|
+
try {
|
|
456
|
+
const response = await this.proxyToAuthServer(
|
|
457
|
+
req,
|
|
458
|
+
'/api/v1/auth/forgot-password',
|
|
459
|
+
req.body
|
|
460
|
+
);
|
|
461
|
+
res.status(response.status).json(response.data);
|
|
462
|
+
} catch (error) {
|
|
463
|
+
this.handleProxyError(error, res);
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
handleVerifyResetCode = async (req, res) => {
|
|
468
|
+
try {
|
|
469
|
+
const response = await this.proxyToAuthServer(
|
|
470
|
+
req,
|
|
471
|
+
'/api/v1/auth/verify-reset-code',
|
|
472
|
+
req.body
|
|
473
|
+
);
|
|
474
|
+
res.status(response.status).json(response.data);
|
|
475
|
+
} catch (error) {
|
|
476
|
+
this.handleProxyError(error, res);
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
handleResetPassword = async (req, res) => {
|
|
481
|
+
try {
|
|
482
|
+
const response = await this.proxyToAuthServer(
|
|
483
|
+
req,
|
|
484
|
+
'/api/v1/auth/reset-password',
|
|
485
|
+
req.body
|
|
486
|
+
);
|
|
487
|
+
res.status(response.status).json(response.data);
|
|
488
|
+
} catch (error) {
|
|
489
|
+
this.handleProxyError(error, res);
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
|
|
448
493
|
middleware() {
|
|
449
494
|
return this.router;
|
|
450
495
|
}
|