mirror of
https://github.com/lukevella/rallly.git
synced 2025-04-29 02:06:34 +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(",");
|
||||
// Check whether the email matches enough of the patterns specified in ALLOWED_EMAILS
|
||||
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);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue