mirror of https://github.com/Chocobozzz/PeerTube
Error on invalid password in reset password script
parent
7f40ce5324
commit
285e04f6dd
|
@ -1,6 +1,7 @@
|
||||||
import * as program from 'commander'
|
import * as program from 'commander'
|
||||||
import { initDatabaseModels } from '../server/initializers'
|
import { initDatabaseModels } from '../server/initializers'
|
||||||
import { UserModel } from '../server/models/account/user'
|
import { UserModel } from '../server/models/account/user'
|
||||||
|
import { isUserPasswordValid } from '../server/helpers/custom-validators/users'
|
||||||
|
|
||||||
program
|
program
|
||||||
.option('-u, --user [user]', 'User')
|
.option('-u, --user [user]', 'User')
|
||||||
|
@ -36,6 +37,11 @@ initDatabaseModels(true)
|
||||||
|
|
||||||
console.log('New password?')
|
console.log('New password?')
|
||||||
rl.on('line', function (password) {
|
rl.on('line', function (password) {
|
||||||
|
if (!isUserPasswordValid(password)) {
|
||||||
|
console.error('New password is invalid.')
|
||||||
|
process.exit(-1)
|
||||||
|
}
|
||||||
|
|
||||||
user.password = password
|
user.password = password
|
||||||
|
|
||||||
user.save()
|
user.save()
|
||||||
|
|
Loading…
Reference in New Issue