aboutsummaryrefslogtreecommitdiff
path: root/src/server/ApiManagers/UserManager.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/ApiManagers/UserManager.ts')
-rw-r--r--src/server/ApiManagers/UserManager.ts16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/server/ApiManagers/UserManager.ts b/src/server/ApiManagers/UserManager.ts
index 0d36ee957..0431b9bcf 100644
--- a/src/server/ApiManagers/UserManager.ts
+++ b/src/server/ApiManagers/UserManager.ts
@@ -8,6 +8,7 @@ import { WebSocket } from '../websocket';
import { resolvedPorts } from '../server_Initialization';
import { DashVersion } from '../../fields/DocSymbols';
import { Utils } from '../../Utils';
+import { check, validationResult } from 'express-validator';
export const timeMap: { [id: string]: number } = {};
interface ActivityUnit {
@@ -108,15 +109,18 @@ export default class UserManager extends ApiManager {
return;
}
- req.assert('new_pass', 'Password must be at least 4 characters long').len({ min: 4 });
- req.assert('new_confirm', 'Passwords do not match').equals(new_pass);
+ check('new_pass', 'Password must be at least 4 characters long')
+ .run(req)
+ .then(chcekcres => console.log(chcekcres)); //.len({ min: 4 });
+ check('new_confirm', 'Passwords do not match')
+ .run(req)
+ .then(theres => console.log(theres)); //.equals(new_pass);
if (curr_pass === new_pass) {
result.error = [{ msg: 'Current and new password are the same' }];
}
- // was there error in validating new passwords?
- if (req.validationErrors()) {
- // was there error?
- result.error = req.validationErrors();
+ if (validationResult(req).array().length) {
+ // was there error in validating new passwords?
+ result.error = validationResult(req);
}
// will only change password if there are no errors.