From e1fa0266753446b79c76b584321fec2e722b80c2 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 14 Feb 2019 09:44:33 +0100 Subject: [PATCH] Error on invalid password in reset password script --- scripts/reset-password.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/reset-password.ts b/scripts/reset-password.ts index 6516edc28..4a9037280 100755 --- a/scripts/reset-password.ts +++ b/scripts/reset-password.ts @@ -1,6 +1,7 @@ import * as program from 'commander' import { initDatabaseModels } from '../server/initializers' import { UserModel } from '../server/models/account/user' +import { isUserPasswordValid } from '../server/helpers/custom-validators/users' program .option('-u, --user [user]', 'User') @@ -36,6 +37,11 @@ initDatabaseModels(true) console.log('New password?') rl.on('line', function (password) { + if (!isUserPasswordValid(password)) { + console.error('New password is invalid.') + process.exit(-1) + } + user.password = password user.save()