mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-01-07 10:19:40 -06:00
Merge pull request #2483 from hackr-sh/fix/first-name-last-name-additional-special-chars
fix: name validation now takes into account additional special chars
This commit is contained in:
@@ -7,7 +7,7 @@ const nameSchema = joi
|
||||
.string()
|
||||
.max(50)
|
||||
.trim()
|
||||
.pattern(/^[\p{L}\p{M}''\- ]+$/u)
|
||||
.pattern(/^[\p{L}\p{M}''()\-\. ]+$/u)
|
||||
.messages({
|
||||
"string.empty": "auth.common.inputs.firstName.errors.empty",
|
||||
"string.max": "auth.common.inputs.firstName.errors.length",
|
||||
@@ -18,7 +18,7 @@ const lastnameSchema = joi
|
||||
.string()
|
||||
.max(50)
|
||||
.trim()
|
||||
.pattern(/^[\p{L}\p{M}''\- ]+$/u)
|
||||
.pattern(/^[\p{L}\p{M}''()\-\. ]+$/u)
|
||||
.messages({
|
||||
"string.empty": "auth.common.inputs.lastName.errors.empty",
|
||||
"string.max": "auth.common.inputs.lastName.errors.length",
|
||||
|
||||
@@ -29,12 +29,12 @@ const nameValidation = joi
|
||||
.string()
|
||||
.trim()
|
||||
.max(50)
|
||||
.pattern(/^(?=.*[\p{L}\p{Sc}])[\p{L}\p{Sc}\s']+$/u)
|
||||
.pattern(/^(?=.*[\p{L}\p{Sc}])[\p{L}\p{Sc}\s'\-().]+$/u)
|
||||
.messages({
|
||||
"string.empty": "Name is required",
|
||||
"string.max": "Name must be less than 50 characters",
|
||||
"string.pattern.base":
|
||||
"Name must contain at least 1 letter or currency symbol and only allow letters, spaces, apostrophes, and currency symbols",
|
||||
"Names must contain at least 1 letter and may only include letters, currency symbols, spaces, apostrophes, hyphens (-), periods (.), and parentheses ().",
|
||||
});
|
||||
|
||||
const registrationBodyValidation = joi.object({
|
||||
|
||||
Reference in New Issue
Block a user