fix: 资金密码

This commit is contained in:
chaosBreaking
2019-09-07 22:04:48 +08:00
parent 89f59a54fd
commit 003bcac623

View File

@@ -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({