Skip to content

Commit

Permalink
fix: email parsing before @
Browse files Browse the repository at this point in the history
  • Loading branch information
Kan-A-Pesh committed Nov 30, 2024
1 parent 2465c9d commit 37d2a2c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion routes/auth/send-mail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export default async function Route_Auth_Sendmail(req: Request, res: Response, n
});
}

const parsedEmail = bodyPayload.data.email.toLowerCase().replace(/\./g, "").replace(/\+.*@/g, "@");
const lowercaseEmail = bodyPayload.data.email.toLowerCase();
const [username, domain] = lowercaseEmail.split("@");
const parsedEmail = `${username.replace(".", "")}@${domain}`.replace(/\+.*@/g, "@");

if (!isAdmin(req)) {
if (/^[a-zA-Z0-9._%-]+@edu\.devinci\.fr$/.test(parsedEmail) === false) {
Expand Down

0 comments on commit 37d2a2c

Please sign in to comment.