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