Skip to content

Commit d4d0120

Browse files
committed
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>
1 parent 027195e commit d4d0120

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

bin/manage_users

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,9 @@ async function createUser (argv) {
4343
}
4444

4545
const pass = getPass(argv, 'add')
46-
const hashedPass = await models.User.hashPassword(pass)
4746

4847
// Lets try to create, and check success
49-
const ref = await models.User.create({ email: argv['add'], password: hashedPass })
48+
const ref = await models.User.create({ email: argv['add'], password: pass })
5049
if (ref === undefined) {
5150
console.log(`Could not create user with email ${argv['add']}`)
5251
process.exit(1)
@@ -80,7 +79,7 @@ async function resetUser (argv) {
8079
const pass = getPass(argv, 'reset')
8180

8281
// set password and save
83-
existingUser.password = await models.User.hashPassword(pass)
82+
existingUser.password = pass
8483
await existingUser.save()
8584
console.log(`User with email ${argv['reset']} password has been reset`)
8685
}

lib/auth/email/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ if (config.allowEmailRegister) {
4444
email: req.body.email
4545
},
4646
defaults: {
47-
password: await models.User.hashPassword(req.body.password)
47+
password: req.body.password
4848
}
4949
})
5050

0 commit comments

Comments
 (0)