cleaned up refs to passwor dhash

This commit is contained in:
Wyatt Johnson
2018-05-03 09:58:49 -06:00
parent a9132c1353
commit 8fee07a3f8
2 changed files with 8 additions and 5 deletions
@@ -5,7 +5,6 @@ const {
ErrIncorrectPassword,
} = require('./errors');
const { get } = require('lodash');
const bcrypt = require('bcryptjs');
// hasLocalProfile checks a user's profiles to see if they already have a local
// profile associated with their account.
@@ -88,7 +87,7 @@ async function attachUserLocalAuth(ctx, email, password) {
await Users.isValidPassword(password);
// Hash the new password.
const hashedPassword = await bcrypt.hash(password, 10);
const hashedPassword = await Users.hashPassword(password);
try {
// Associate the account with the user.
+7 -3
View File
@@ -557,7 +557,7 @@ class Users {
throw new ErrPasswordTooShort();
}
const hashedPassword = await bcrypt.hash(password, SALT_ROUNDS);
const hashedPassword = await Users.hashPassword(password);
return User.update(
{ id },
@@ -634,7 +634,7 @@ class Users {
Users.isValidPassword(password),
]);
const hashedPassword = await bcrypt.hash(password, SALT_ROUNDS);
const hashedPassword = await Users.hashPassword(password);
let user = new User({
username,
@@ -811,6 +811,10 @@ class Users {
return { user, redirect, version };
}
static async hashPassword(password) {
return bcrypt.hash(password, SALT_ROUNDS);
}
// TODO: update doc
static async resetPassword(token, password) {
const { user, redirect, version } = await this.verifyPasswordResetToken(
@@ -821,7 +825,7 @@ class Users {
throw new ErrPasswordTooShort();
}
const hashedPassword = await bcrypt.hash(password, SALT_ROUNDS);
const hashedPassword = await Users.hashPassword(password);
// Update the user's password.
await User.update(