X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Freset-password.ts;h=6126c3cd09fa9da04c57b1c52852ad3196627f66;hb=64645512b08875c18ebdc009a550cdfa69def955;hp=6516edc287b776f5f3295f693fd9f559ea059e23;hpb=91fea9fc48a4ce53dd69e0e20f5804ad95a6c27d;p=github%2FChocobozzz%2FPeerTube.git diff --git a/scripts/reset-password.ts b/scripts/reset-password.ts index 6516edc28..6126c3cd0 100755 --- a/scripts/reset-password.ts +++ b/scripts/reset-password.ts @@ -1,6 +1,10 @@ +import { registerTSPaths } from '../server/helpers/register-ts-paths' +registerTSPaths() + 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 +40,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()