Skip to content

Commit

Permalink
Require name and surname
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejSWM committed Feb 23, 2024
1 parent 8609295 commit 8cc6030
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,10 @@ export default {
onboarding: {
welcome: 'Welcome!',
whatsYourName: "What's your name?",
error: {
requiredFirstName: 'Please input your first name to continue',
requiredLasttName: 'Please input your last name to continue',
},
},
personalDetails: {
error: {
Expand Down
6 changes: 6 additions & 0 deletions src/pages/OnboardingPersonalDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ function OnboardingPersonalDetails({currentUserPersonalDetails}: OnboardingPerso
const errors = {};

// First we validate the first name field
if (!ValidationUtils.isRequiredFulfilled(values.firstName)) {
ErrorUtils.addErrorMessage(errors, 'firstName', 'onboarding.error.requiredFirstName');
}
if (!ValidationUtils.isValidDisplayName(values.firstName)) {
ErrorUtils.addErrorMessage(errors, 'firstName', 'personalDetails.error.hasInvalidCharacter');
}
Expand All @@ -50,6 +53,9 @@ function OnboardingPersonalDetails({currentUserPersonalDetails}: OnboardingPerso
}

// Then we validate the last name field
if (!ValidationUtils.isRequiredFulfilled(values.lastName)) {
ErrorUtils.addErrorMessage(errors, 'lastName', 'onboarding.error.requiredLasttName');
}
if (!ValidationUtils.isValidDisplayName(values.lastName)) {
ErrorUtils.addErrorMessage(errors, 'lastName', 'personalDetails.error.hasInvalidCharacter');
}
Expand Down

0 comments on commit 8cc6030

Please sign in to comment.