Change Password Not altering to new password
Closed this issue · 0 comments
edesilets commented
Current code doesn't alter the current password to the new password. Please see below...
Location:
express-template/app/controllers/users.js
Line 99
const changepw = (req, res, next) => {
debug('Changing password');
User.findOne({
_id: req.params.id,
token: req.currentUser.token,
}).then(user =>
user ? user.comparePassword(req.body.passwords.old) :
Promise.reject(new HttpError(404))
).then(user =>
- user.setPassword(req.body.passwords.old)
+ user.setPassword(req.body.passwords.new)
).then((/* user */) =>
res.sendStatus(200)
).catch(makeErrorHandler(res, next));
};