From 4387903cdbbaeeca8fb183972eaa7b3afbfe9fe9 Mon Sep 17 00:00:00 2001 From: harbassan Date: Sun, 20 Oct 2024 17:41:30 +1300 Subject: [PATCH] fix: wrong conditionals in email validation --- backend/src/routes/api/user.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/src/routes/api/user.js b/backend/src/routes/api/user.js index 42b0bc1b..0569f0bd 100644 --- a/backend/src/routes/api/user.js +++ b/backend/src/routes/api/user.js @@ -66,9 +66,8 @@ router.post( handle(async (req, res) => { const email = req?.body?.email || ""; if ( - !(email.split("@").length > 1) && - !allowedDomains.has(email.split("@")[1]) && - !allowedEmails.has(email) + email.split("@").length <= 1 || + (!allowedDomains.has(email.split("@")[1]) && !allowedEmails.has(email)) ) { throw new HttpError("Sign in with your UoA account", STATUS.FORBIDDEN); }