diff --git a/packages/common/src/config.ts b/packages/common/src/config.ts index 83fa4595b1..1c38bdc794 100644 --- a/packages/common/src/config.ts +++ b/packages/common/src/config.ts @@ -29,8 +29,12 @@ Ethereal Engine. All Rights Reserved. const localBuildOrDev = globalThis.process.env.APP_ENV === 'development' || globalThis.process.env.VITE_LOCAL_BUILD === 'true' +// https://fightingforalostcause.net/content/misc/2006/compare-email-regex.php +const EMAIL_REGEX = + /^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$/i + export function validateEmail(email: string): boolean { - return /^\w+([.-]?\w+)*@\w+([.-]?\w+)*(\.\w{2,3})+$/.test(email) + return EMAIL_REGEX.test(email) } export function validatePhoneNumber(phone: string): boolean {