fix: 哈希salt传参错误

This commit is contained in:
chaosBreaking
2019-09-07 10:46:14 +08:00
parent 46406b6b39
commit 762e54c2cf

View File

@@ -179,7 +179,7 @@ module.exports = {
msg: 'Incorrect code'
});
}
const newPasswd = Crypto.hash(password, PWD_HASH_SALT);
const newPasswd = Crypto.hash(password, { salt: PWD_HASH_SALT });
const query = { phone };
const update = { password: newPasswd };
// eslint-disable-next-line no-unused-vars
@@ -208,7 +208,7 @@ module.exports = {
code: 1,
msg: '原始密码错误'
});
const newHashPasswd = Crypto.hash(newPassword, PWD_HASH_SALT);
const newHashPasswd = Crypto.hash(newPassword, { salt: PWD_HASH_SALT });
const update = { password: newHashPasswd };
const success = await User.findByIdAndUpdate(userId, update, { new: true })
// eslint-disable-next-line no-unused-vars