From b5752024e700db3dbc8b3090d08204233d82653b Mon Sep 17 00:00:00 2001 From: Mohammad Al-Ahdal Date: Tue, 17 Jun 2025 18:29:09 -0600 Subject: [PATCH 1/2] fix: name validation now takes into account additional special chars --- client/src/Validation/validation.js | 4 ++-- server/validation/joi.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/Validation/validation.js b/client/src/Validation/validation.js index f1811a124..02d957063 100644 --- a/client/src/Validation/validation.js +++ b/client/src/Validation/validation.js @@ -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", diff --git a/server/validation/joi.js b/server/validation/joi.js index 725fcf218..904f06b97 100755 --- a/server/validation/joi.js +++ b/server/validation/joi.js @@ -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 the following characters: a-z, A-Z, and any of the following symbols: -'.()", }); const registrationBodyValidation = joi.object({ From c9359cc4e1323e3263066f7129c1c1cb96ea904e Mon Sep 17 00:00:00 2001 From: Mohammad Al-Ahdal Date: Tue, 17 Jun 2025 18:40:51 -0600 Subject: [PATCH 2/2] implement server-validation wording feedback --- server/validation/joi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/validation/joi.js b/server/validation/joi.js index 904f06b97..e684cefa2 100755 --- a/server/validation/joi.js +++ b/server/validation/joi.js @@ -34,7 +34,7 @@ const nameValidation = joi "string.empty": "Name is required", "string.max": "Name must be less than 50 characters", "string.pattern.base": - "Names must contain at least 1 letter and may only include the following characters: a-z, A-Z, and any of the following 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({