fix: sign重置密码读token错误

This commit is contained in:
chaosBreaking
2019-09-07 23:44:52 +08:00
parent 003bcac623
commit 898ed9c6c1

View File

@@ -206,7 +206,7 @@ module.exports = {
changePasswd: inject(function (SysConfig) { changePasswd: inject(function (SysConfig) {
const { PWD_HASH_SALT } = SysConfig; const { PWD_HASH_SALT } = SysConfig;
return async (req, res) => { return async (req, res) => {
const { userId } = res.locale.user; const { userId } = res.locals.user;
const { password, newPassword } = req.body; const { password, newPassword } = req.body;
const user = User.findById(userId); const user = User.findById(userId);
if (!user || user.password !== Crypto.hash(password, { salt: PWD_HASH_SALT })) if (!user || user.password !== Crypto.hash(password, { salt: PWD_HASH_SALT }))