diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 6b26a46f6..bf7b50dae 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -1731,6 +1731,7 @@ "SIGNUP_FORM_EMAIL_DISPOSABLE_NOT_ALLOWED": "Temporary email addresses are not allowed", "SIGNUP_FORM_EMAIL_INVALID": "Please enter a valid email address", "SIGNUP_FORM_EMAIL_LABEL": "Work Email", + "SIGNUP_FORM_EMAIL_MUST_BE_A_WORK_EMAIL": "Oops! It looks like a personal email. Please use your work email.", "SIGNUP_FORM_EMAIL_PLACEHOLDER": "Insert Email", "SIGNUP_FORM_EMAIL_REQUIRED": "Email is required", "SIGNUP_FORM_NAME_LABEL": "First name", diff --git a/src/locales/it/translation.json b/src/locales/it/translation.json index e0a22121c..e4bc43fbc 100644 --- a/src/locales/it/translation.json +++ b/src/locales/it/translation.json @@ -1775,6 +1775,7 @@ "SIGNUP_FORM_EMAIL_DISPOSABLE_NOT_ALLOWED": "", "SIGNUP_FORM_EMAIL_INVALID": "", "SIGNUP_FORM_EMAIL_LABEL": "", + "SIGNUP_FORM_EMAIL_MUST_BE_A_WORK_EMAIL": "", "SIGNUP_FORM_EMAIL_PLACEHOLDER": "", "SIGNUP_FORM_EMAIL_REQUIRED": "", "SIGNUP_FORM_NAME_LABEL": "", diff --git a/src/pages/JoinPage/SignupPage/validationSchema.ts b/src/pages/JoinPage/SignupPage/validationSchema.ts index 53cb1dad8..36e41eb77 100644 --- a/src/pages/JoinPage/SignupPage/validationSchema.ts +++ b/src/pages/JoinPage/SignupPage/validationSchema.ts @@ -5,7 +5,63 @@ export const getSignupValidationSchema = (t: TFunction) => Yup.object().shape({ email: Yup.string() .email(t('SIGNUP_FORM_EMAIL_INVALID')) - .required(t('SIGNUP_FORM_EMAIL_REQUIRED')), + .required(t('SIGNUP_FORM_EMAIL_REQUIRED')) + .test( + 'not-work-email', + t('SIGNUP_FORM_EMAIL_MUST_BE_A_WORK_EMAIL'), + (value) => { + if (!value) return true; + const invalidDomains = [ + 'gmail.com', + 'googlemail.com', + 'yahoo.com', + 'yahoo.it', + 'hotmail.com', + 'hotmail.it', + 'outlook.com', + 'outlook.it', + 'live.com', + 'msn.com', + 'icloud.com', + 'me.com', + 'mac.com', + 'aol.com', + 'protonmail.com', + 'Proton: Privacy by default', + 'gmx.com', + 'gmx.net', + 'mail.com', + 'zoho.com', + 'yandex.com', + 'fastmail.com', + 'tiscali.it', + 'virgilio.it', + 'libero.it', + 'inwind.it', + 'blu.it', + 'email.it', + 'tin.it', + 'hotmail.fr', + 'live.fr', + 'outlook.fr', + 'wanadoo.fr', + 'orange.fr', + 'free.fr', + 'sfr.fr', + 'laposte.net', + 'bbox.fr', + 'neuf.fr', + 'numericable.fr', + 'club-internet.fr', + 'noos.fr', + 'aliceadsl.fr', + 'cegetel.net', + ]; + return !invalidDomains.some((domain) => + value.toLowerCase().endsWith(`@${domain}`) + ); + } + ), password: Yup.string() .min(12, t('SIGNUP_FORM_PASSWORD_MUST_BE_AT_LEAST_12_CHARACTER_LONG')) .matches(