diff --git a/src/modules/user/user.controller.js b/src/modules/user/user.controller.js index ccd07e7..6977da2 100644 --- a/src/modules/user/user.controller.js +++ b/src/modules/user/user.controller.js @@ -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({