propro-utils 1.5.80 → 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/middlewares/account_info.js +1 -2
- package/package.json +1 -1
- package/src/server/index.js +46 -4
|
@@ -202,12 +202,11 @@ const checkIfUserExists = async accountId => {
|
|
|
202
202
|
}
|
|
203
203
|
|
|
204
204
|
// Handle themes
|
|
205
|
-
console.log('themeSchema:', themeSchema);
|
|
206
205
|
if (themeSchema) {
|
|
207
206
|
updates.push(
|
|
208
207
|
(async () => {
|
|
209
208
|
const defaultThemeExists = await themeSchema.exists({
|
|
210
|
-
|
|
209
|
+
name: 'Default Theme',
|
|
211
210
|
accountId,
|
|
212
211
|
});
|
|
213
212
|
|
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) => {
|
|
@@ -157,10 +160,7 @@ class AuthMiddleware {
|
|
|
157
160
|
this.options.redirectUri
|
|
158
161
|
);
|
|
159
162
|
|
|
160
|
-
console.log('tokens:', tokens);
|
|
161
|
-
console.log('account:', account);
|
|
162
163
|
const user = await checkIfUserExists(account.accountId);
|
|
163
|
-
console.log('user:', user);
|
|
164
164
|
|
|
165
165
|
if (!user) {
|
|
166
166
|
throw new Error('User not found');
|
|
@@ -345,7 +345,10 @@ class AuthMiddleware {
|
|
|
345
345
|
return (
|
|
346
346
|
!path.includes('/api/v1/auth/login') &&
|
|
347
347
|
!path.includes('/api/v1/auth/signup') &&
|
|
348
|
-
!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')
|
|
349
352
|
);
|
|
350
353
|
};
|
|
351
354
|
|
|
@@ -448,6 +451,45 @@ class AuthMiddleware {
|
|
|
448
451
|
}
|
|
449
452
|
};
|
|
450
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
|
+
|
|
451
493
|
middleware() {
|
|
452
494
|
return this.router;
|
|
453
495
|
}
|