Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1426,6 +1426,7 @@
"SIGNUP_FORM_EMAIL_IS_REQUIRED": "This field is required",
"SIGNUP_FORM_EMAIL_LABEL": "Work Email",
"SIGNUP_FORM_EMAIL_MUST_BE_A_VALID_EMAIL": "Oops! Check your email format",
"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_GO_TO_STEP_2": "Create my account",
"SIGNUP_FORM_GO_TO_STEP_3": "Next",
Expand Down
1 change: 1 addition & 0 deletions src/locales/it/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1470,6 +1470,7 @@
"SIGNUP_FORM_EMAIL_IS_REQUIRED": "",
"SIGNUP_FORM_EMAIL_LABEL": "",
"SIGNUP_FORM_EMAIL_MUST_BE_A_VALID_EMAIL": "",
"SIGNUP_FORM_EMAIL_MUST_BE_A_WORK_EMAIL": "",
"SIGNUP_FORM_EMAIL_PLACEHOLDER": "",
"SIGNUP_FORM_GO_TO_STEP_2": "",
"SIGNUP_FORM_GO_TO_STEP_3": "",
Expand Down
45 changes: 43 additions & 2 deletions src/pages/JoinPage/validationSchema.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as yup from 'yup';
import { useTranslation } from 'react-i18next';
import * as yup from 'yup';

export const useValidationSchema = () => {
const { t } = useTranslation();
Expand All @@ -10,7 +10,48 @@ export const useValidationSchema = () => {
then: yup
.string()
.required(t('SIGNUP_FORM_EMAIL_IS_REQUIRED'))
.email(t('SIGNUP_FORM_EMAIL_MUST_BE_A_VALID_EMAIL')),
.email(t('SIGNUP_FORM_EMAIL_MUST_BE_A_VALID_EMAIL'))
.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',
];
return !invalidDomains.some((domain) =>
value.toLowerCase().endsWith(`@${domain}`)
);
}
),
}),
password: yup.string().when('step', {
is: 1,
Expand Down
Loading