Merge pull request #1419 from bluewave-labs/fix/fe/password-boot
fix: incorrect password on password change causes user to be logged out, resolves #1384
This commit is contained in:
1 file changed
+3
-2
@@ -281,10 +281,11 @@ const editUser = async (req, res, next) => {
|
||||
const user = await req.db.getUserByEmail(email);
|
||||
// Compare passwords
|
||||
const match = await user.comparePassword(req.body.password);
|
||||
// If not a match, throw a 401
|
||||
// If not a match, throw a 403
|
||||
// 403 instead of 401 to avoid triggering axios interceptor
|
||||
if (!match) {
|
||||
const error = new Error(errorMessages.AUTH_INCORRECT_PASSWORD);
|
||||
error.status = 401;
|
||||
error.status = 403;
|
||||
next(error);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user