Skip to content

Commit

Permalink
feat: updates contact form val. (first/last name)
Browse files Browse the repository at this point in the history
- disallows entries beginning with special characters
  • Loading branch information
mohitb35 committed Nov 20, 2023
1 parent 9f30128 commit 8b0b916
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions public/static/locales/en/editProfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
"validationErrors": {
"maxChars": "Should be {{max}} characters or less",
"firstNameRequired": "First Name field is required",
"firstNameInvalid": "First name is invalid. Only these special characters are allowed: space ' . -",
"firstNameInvalid": "First name is invalid. It cannot start with a special character, and only these special characters are allowed: space ' . -",
"lastNameRequired": "Last Name field is required",
"lastNameInvalid": "Last name is invalid. Only these special characters are allowed: space ' -",
"lastNameInvalid": "Last name is invalid. It cannot start with a special character, and only these special characters are allowed: space ' -",
"emailRequired": "Email is required",
"nameRequired": "Please enter a name",
"nameInvalid": "Name is invalid. Only these special characters are allowed: space . , ' & ( ) ! -",
Expand Down
4 changes: 2 additions & 2 deletions src/features/user/CompleteSignup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export default function CompleteSignup(): ReactElement | null {
message: t('validationErrors.maxChars', { max: 50 }),
},
pattern: {
value: /^[\p{L}\p{N}\sß.'-]+$/u,
value: /^[\p{L}\p{N}ß][\p{L}\p{N}\sß.'-]*$/u,
message: t('validationErrors.firstNameInvalid'),
},
}}
Expand Down Expand Up @@ -335,7 +335,7 @@ export default function CompleteSignup(): ReactElement | null {
message: t('validationErrors.maxChars', { max: 50 }),
},
pattern: {
value: /^[\p{L}\p{N}\sß'-]+$/u,
value: /^[\p{L}\p{N}ß][\p{L}\p{N}\sß'-]*$/u,
message: t('validationErrors.lastNameInvalid'),
},
}}
Expand Down

0 comments on commit 8b0b916

Please sign in to comment.