From 01c860736922e0150617c558626abcd8238a9949 Mon Sep 17 00:00:00 2001 From: Chisomchima Date: Thu, 12 Dec 2024 11:31:04 +0100 Subject: [PATCH] chore: update regex for email --- src/layout/VerifyEmail.component.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/layout/VerifyEmail.component.js b/src/layout/VerifyEmail.component.js index daa30787..0abfd373 100644 --- a/src/layout/VerifyEmail.component.js +++ b/src/layout/VerifyEmail.component.js @@ -9,8 +9,8 @@ const sendEmailVerificationMutation = { type: 'create', } -const emailRegex = - /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i +const emailRegExp = + /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/ export function VerifyEmail({ userEmail }) { const errorAlert = useAlert(({ message }) => message, { critical: true }) @@ -37,7 +37,7 @@ export function VerifyEmail({ userEmail }) { const emailConfigured = systemInfo?.emailConfigured - const isValidEmail = emailRegex.test(userEmail) + const isValidEmail = emailRegExp.test(userEmail) if (!emailConfigured) { return null