From df11a457f1f830f2c8c96a808b94440c401d884b Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Mon, 16 Dec 2024 18:20:41 -0800 Subject: [PATCH 1/2] 401 -> 403 --- Server/controllers/authController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/controllers/authController.js b/Server/controllers/authController.js index 1fba9c92f..fb48796df 100644 --- a/Server/controllers/authController.js +++ b/Server/controllers/authController.js @@ -284,7 +284,7 @@ const editUser = async (req, res, next) => { // If not a match, throw a 401 if (!match) { const error = new Error(errorMessages.AUTH_INCORRECT_PASSWORD); - error.status = 401; + error.status = 403; next(error); return; } From a42e280e490d3ba78e1682db17bdc3b3148c6c2d Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Tue, 17 Dec 2024 10:02:56 -0800 Subject: [PATCH 2/2] update comments --- Server/controllers/authController.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Server/controllers/authController.js b/Server/controllers/authController.js index fb48796df..b7e4a7808 100644 --- a/Server/controllers/authController.js +++ b/Server/controllers/authController.js @@ -281,7 +281,8 @@ 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 = 403;