Skip to content

Commit 5b2b9c6

Browse files
authored
Merge pull request Expensify#64545 from nkdengineer/fix/63953
fix: Can use the legal name Concierge or Expensify
2 parents ba687b4 + 1060c81 commit 5b2b9c6

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/components/SubStepForms/FullNameStep.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import TextInput from '@components/TextInput';
88
import useLocalize from '@hooks/useLocalize';
99
import type {SubStepProps} from '@hooks/useSubStep/types';
1010
import useThemeStyles from '@hooks/useThemeStyles';
11-
import {getFieldRequiredErrors, isRequiredFulfilled, isValidLegalName} from '@libs/ValidationUtils';
11+
import {doesContainReservedWord, getFieldRequiredErrors, isRequiredFulfilled, isValidLegalName} from '@libs/ValidationUtils';
1212
import HelpLinks from '@pages/ReimbursementAccount/USD/Requestor/PersonalInfo/HelpLinks';
1313
import CONST from '@src/CONST';
1414
import type {OnyxFormValuesMapping} from '@src/ONYXKEYS';
@@ -87,6 +87,11 @@ function FullNameStep<TFormID extends keyof OnyxFormValuesMapping>({
8787
});
8888
}
8989

90+
if (doesContainReservedWord(firstName, CONST.DISPLAY_NAME.RESERVED_NAMES)) {
91+
// @ts-expect-error type mismatch to be fixed
92+
errors[firstNameInputID] = translate('personalDetails.error.containsReservedWord');
93+
}
94+
9095
const lastName = values[lastNameInputID as keyof FormOnyxValues<TFormID>] as string;
9196
if (!isRequiredFulfilled(lastName)) {
9297
// @ts-expect-error type mismatch to be fixed
@@ -101,6 +106,11 @@ function FullNameStep<TFormID extends keyof OnyxFormValuesMapping>({
101106
limit: CONST.LEGAL_NAME.MAX_LENGTH,
102107
});
103108
}
109+
110+
if (doesContainReservedWord(lastName, CONST.DISPLAY_NAME.RESERVED_NAMES)) {
111+
// @ts-expect-error type mismatch to be fixed
112+
errors[lastNameInputID] = translate('personalDetails.error.containsReservedWord');
113+
}
104114
return errors;
105115
},
106116
[firstNameInputID, lastNameInputID, stepFields, translate],

0 commit comments

Comments
 (0)