From d4d0120ab7c7eaaf8a0a606fad61c586171bc84d Mon Sep 17 00:00:00 2001 From: BinotaLIU Date: Tue, 14 Apr 2020 23:17:16 +0800 Subject: [PATCH] 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 --- bin/manage_users | 5 ++--- lib/auth/email/index.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bin/manage_users b/bin/manage_users index 53006f02..113352a3 100755 --- a/bin/manage_users +++ b/bin/manage_users @@ -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`) } diff --git a/lib/auth/email/index.js b/lib/auth/email/index.js index 5d94adcb..40adf0d9 100644 --- a/lib/auth/email/index.js +++ b/lib/auth/email/index.js @@ -44,7 +44,7 @@ if (config.allowEmailRegister) { email: req.body.email }, defaults: { - password: await models.User.hashPassword(req.body.password) + password: req.body.password } })