fix: 哈希salt传参错误
This commit is contained in:
@@ -179,7 +179,7 @@ module.exports = {
|
|||||||
msg: 'Incorrect code'
|
msg: 'Incorrect code'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
const newPasswd = Crypto.hash(password, PWD_HASH_SALT);
|
const newPasswd = Crypto.hash(password, { salt: PWD_HASH_SALT });
|
||||||
const query = { phone };
|
const query = { phone };
|
||||||
const update = { password: newPasswd };
|
const update = { password: newPasswd };
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
@@ -208,7 +208,7 @@ module.exports = {
|
|||||||
code: 1,
|
code: 1,
|
||||||
msg: '原始密码错误'
|
msg: '原始密码错误'
|
||||||
});
|
});
|
||||||
const newHashPasswd = Crypto.hash(newPassword, PWD_HASH_SALT);
|
const newHashPasswd = Crypto.hash(newPassword, { salt: PWD_HASH_SALT });
|
||||||
const update = { password: newHashPasswd };
|
const update = { password: newHashPasswd };
|
||||||
const success = await User.findByIdAndUpdate(userId, update, { new: true })
|
const success = await User.findByIdAndUpdate(userId, update, { new: true })
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
|||||||
Reference in New Issue
Block a user