Skip to content

Commit

Permalink
Merge pull request #41047 from Expensify/francois-onboarding-name-req…
Browse files Browse the repository at this point in the history
…uire-first-name

[CP Staging] Disallow blank first names, allow blank surnames during onboarding

(cherry picked from commit 815b23a)
  • Loading branch information
mountiny authored and OSBotify committed Apr 26, 2024
1 parent 5cb08f4 commit 4795517
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 6 deletions.
1 change: 0 additions & 1 deletion src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1336,7 +1336,6 @@ export default {
},
error: {
requiredFirstName: 'Please input your first name to continue',
requiredLastName: 'Please input your last name to continue',
},
},
personalDetails: {
Expand Down
1 change: 0 additions & 1 deletion src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1335,7 +1335,6 @@ export default {
},
error: {
requiredFirstName: 'Introduce tu nombre para continuar',
requiredLastName: 'Introduce tu apellido para continuar',
},
},
personalDetails: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNat
const errors = {};

// First we validate the first name field
if (values.firstName.length === 0) {
if (values.firstName.replace(CONST.REGEX.ANY_SPACE, '').length === 0) {
ErrorUtils.addErrorMessage(errors, 'firstName', 'onboarding.error.requiredFirstName');
}
if (!ValidationUtils.isValidDisplayName(values.firstName)) {
Expand All @@ -103,9 +103,6 @@ function BaseOnboardingPersonalDetails({currentUserPersonalDetails, shouldUseNat
}

// Then we validate the last name field
if (values.lastName.length === 0) {
ErrorUtils.addErrorMessage(errors, 'lastName', 'onboarding.error.requiredLastName');
}
if (!ValidationUtils.isValidDisplayName(values.lastName)) {
ErrorUtils.addErrorMessage(errors, 'lastName', 'personalDetails.error.hasInvalidCharacter');
} else if (values.lastName.length > CONST.DISPLAY_NAME.MAX_LENGTH) {
Expand Down

0 comments on commit 4795517

Please sign in to comment.