diff options
author | bobzel <zzzman@gmail.com> | 2023-12-06 13:27:41 -0500 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2023-12-06 13:27:41 -0500 |
commit | e5c2c25f9d27e718eb34ec5f05c72c4cd1c22987 (patch) | |
tree | ad963e54d1100841c677b248c88cacaa945ac2da /src/server/ApiManagers/UserManager.ts | |
parent | b80d27912cd6d8bc4fe039e52d16582bfbe72c74 (diff) |
catch mongo errors. delete (some) sessions from mongo. more package updates. cleanup of express-validator.
Diffstat (limited to 'src/server/ApiManagers/UserManager.ts')
-rw-r--r-- | src/server/ApiManagers/UserManager.ts | 16 |
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. |