mirror of
https://github.com/status-im/codimd.git
synced 2025-02-28 03:30:30 +00:00
prevert directly call of User.hashPassword()
this preverted changes made in 7b8576d. now we use hooks to hash password. no need to call User.hashPassword() manually. Signed-off-by: BinotaLIU <me@binota.org>
This commit is contained in:
parent
027195e973
commit
d4d0120ab7
@ -43,10 +43,9 @@ async function createUser (argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const pass = getPass(argv, 'add')
|
const pass = getPass(argv, 'add')
|
||||||
const hashedPass = await models.User.hashPassword(pass)
|
|
||||||
|
|
||||||
// Lets try to create, and check success
|
// Lets try to create, and check success
|
||||||
const ref = await models.User.create({ email: argv['add'], password: hashedPass })
|
const ref = await models.User.create({ email: argv['add'], password: pass })
|
||||||
if (ref === undefined) {
|
if (ref === undefined) {
|
||||||
console.log(`Could not create user with email ${argv['add']}`)
|
console.log(`Could not create user with email ${argv['add']}`)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
@ -80,7 +79,7 @@ async function resetUser (argv) {
|
|||||||
const pass = getPass(argv, 'reset')
|
const pass = getPass(argv, 'reset')
|
||||||
|
|
||||||
// set password and save
|
// set password and save
|
||||||
existingUser.password = await models.User.hashPassword(pass)
|
existingUser.password = pass
|
||||||
await existingUser.save()
|
await existingUser.save()
|
||||||
console.log(`User with email ${argv['reset']} password has been reset`)
|
console.log(`User with email ${argv['reset']} password has been reset`)
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ if (config.allowEmailRegister) {
|
|||||||
email: req.body.email
|
email: req.body.email
|
||||||
},
|
},
|
||||||
defaults: {
|
defaults: {
|
||||||
password: await models.User.hashPassword(req.body.password)
|
password: req.body.password
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user