Skip to content

Commit

Permalink
Fix Emails Loading (#253)
Browse files Browse the repository at this point in the history
* Fix Emails Loading

* Run linters
  • Loading branch information
JordanBlenn authored Oct 4, 2024
1 parent 507bb1a commit 67db070
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion backend/src/routes/api/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,21 @@ const allowedDomains = new Set([
"aucklanduni.ac.nz",
]);

const allowedEmails = new Set([
"wdccvpstesting1@gmail.com",
"wdccvpstesting2@gmail.com",
]);

// handles a sign in request
router.post(
"/",
handle(async (req, res) => {
if (!allowedDomains.has(req.body.email.split("@")[1])) {
const email = req?.body?.email || "";
if (
!(email.split("@").length > 1) &&
!allowedDomains.has(email.split("@")[1]) &&
!allowedEmails.has(email)
) {
throw new HttpError("Sign in with your UoA account", STATUS.FORBIDDEN);
}
if (!(await retrieveUserByEmail(req.body.email))) {
Expand Down

0 comments on commit 67db070

Please sign in to comment.