mirror of
https://github.com/lukevella/rallly.git
synced 2025-06-11 07:01:49 +02:00
🐛 Fix allowed email address matcher (#858)
This commit is contained in:
parent
023cf1bc00
commit
7e3713ad75
1 changed files with 5 additions and 1 deletions
|
@ -52,7 +52,11 @@ const isEmailBlocked = (email: string) => {
|
||||||
const allowedEmails = process.env.ALLOWED_EMAILS.split(",");
|
const allowedEmails = process.env.ALLOWED_EMAILS.split(",");
|
||||||
// Check whether the email matches enough of the patterns specified in ALLOWED_EMAILS
|
// Check whether the email matches enough of the patterns specified in ALLOWED_EMAILS
|
||||||
const isAllowed = allowedEmails.some((allowedEmail) => {
|
const isAllowed = allowedEmails.some((allowedEmail) => {
|
||||||
const regex = new RegExp(allowedEmail.trim().replace("*", ".*"), "i");
|
const regex = new RegExp(
|
||||||
|
`^${allowedEmail
|
||||||
|
.replace(/[.+?^${}()|[\]\\]/g, "\\$&")
|
||||||
|
.replaceAll(/[*]/g, ".*")}$`,
|
||||||
|
);
|
||||||
return regex.test(email);
|
return regex.test(email);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue