mirror of
https://github.com/status-im/codimd.git
synced 2025-02-27 22:30:29 +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 hashedPass = await models.User.hashPassword(pass)
|
||||
|
||||
// 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) {
|
||||
console.log(`Could not create user with email ${argv['add']}`)
|
||||
process.exit(1)
|
||||
@ -80,7 +79,7 @@ async function resetUser (argv) {
|
||||
const pass = getPass(argv, 'reset')
|
||||
|
||||
// set password and save
|
||||
existingUser.password = await models.User.hashPassword(pass)
|
||||
existingUser.password = pass
|
||||
await existingUser.save()
|
||||
console.log(`User with email ${argv['reset']} password has been reset`)
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ if (config.allowEmailRegister) {
|
||||
email: req.body.email
|
||||
},
|
||||
defaults: {
|
||||
password: await models.User.hashPassword(req.body.password)
|
||||
password: req.body.password
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user