diff options
author | Chocobozzz <me@florianbigard.com> | 2019-02-14 09:44:33 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-02-14 09:44:33 +0100 |
commit | e1fa0266753446b79c76b584321fec2e722b80c2 (patch) | |
tree | 2a467190b6ecfe116c018da4788b006e4ced1da5 /scripts/reset-password.ts | |
parent | f5305c04aae14467d6f957b713c5a902275cbb89 (diff) | |
download | PeerTube-e1fa0266753446b79c76b584321fec2e722b80c2.tar.gz PeerTube-e1fa0266753446b79c76b584321fec2e722b80c2.tar.zst PeerTube-e1fa0266753446b79c76b584321fec2e722b80c2.zip |
Error on invalid password in reset password script
Diffstat (limited to 'scripts/reset-password.ts')
-rwxr-xr-x | scripts/reset-password.ts | 6 |
1 files changed, 6 insertions, 0 deletions
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 @@ | |||
1 | import * as program from 'commander' | 1 | import * as program from 'commander' |
2 | import { initDatabaseModels } from '../server/initializers' | 2 | import { initDatabaseModels } from '../server/initializers' |
3 | import { UserModel } from '../server/models/account/user' | 3 | import { UserModel } from '../server/models/account/user' |
4 | import { isUserPasswordValid } from '../server/helpers/custom-validators/users' | ||
4 | 5 | ||
5 | program | 6 | program |
6 | .option('-u, --user [user]', 'User') | 7 | .option('-u, --user [user]', 'User') |
@@ -36,6 +37,11 @@ initDatabaseModels(true) | |||
36 | 37 | ||
37 | console.log('New password?') | 38 | console.log('New password?') |
38 | rl.on('line', function (password) { | 39 | rl.on('line', function (password) { |
40 | if (!isUserPasswordValid(password)) { | ||
41 | console.error('New password is invalid.') | ||
42 | process.exit(-1) | ||
43 | } | ||
44 | |||
39 | user.password = password | 45 | user.password = password |
40 | 46 | ||
41 | user.save() | 47 | user.save() |