fix: 资金密码
This commit is contained in:
@@ -93,11 +93,13 @@ module.exports = {
|
||||
const { userId } = res.locals.user;
|
||||
const { password, newPassword } = req.body;
|
||||
return User.findById(userId).then(async user => {
|
||||
const hashPasswd = Crypto.hash(password);
|
||||
if (user.fundPwd !== hashPasswd) return res.json({
|
||||
code: 1,
|
||||
msg: '原资金密码不正确'
|
||||
});
|
||||
if (user.fundPwd) {
|
||||
const hashPasswd = Crypto.hash(password);
|
||||
if (user.fundPwd !== hashPasswd) return res.json({
|
||||
code: 1,
|
||||
msg: '原资金密码不正确'
|
||||
});
|
||||
}
|
||||
const newHashFundPwd = Crypto.hash(newPassword);
|
||||
user.updateOne({ fundPwd: newHashFundPwd }).then(() => {
|
||||
return res.json({
|
||||
|
||||
Reference in New Issue
Block a user