fix(validators): add Polish characters support for first/last name validation

- Add ąćęłńóśźżĄĆĘŁŃÓŚŹŻ to regex pattern
- Fixes registration rejecting Polish characters in names
This commit is contained in:
Radosław Gierwiało
2025-12-07 20:57:03 +01:00
parent c6cea11bec
commit d780b544b0

View File

@@ -60,14 +60,14 @@ const registerValidation = [
.trim() .trim()
.isLength({ max: 100 }) .isLength({ max: 100 })
.withMessage('First name must be less than 100 characters') .withMessage('First name must be less than 100 characters')
.matches(/^[a-zA-ZÀ-ÿ\s'-]+$/) .matches(/^[a-zA-ZÀ-ÿąćęłńóśźżĄĆĘŁŃÓŚŹŻ\s'-]+$/)
.withMessage('First name contains invalid characters'), .withMessage('First name contains invalid characters'),
body('lastName') body('lastName')
.optional() .optional()
.trim() .trim()
.isLength({ max: 100 }) .isLength({ max: 100 })
.withMessage('Last name must be less than 100 characters') .withMessage('Last name must be less than 100 characters')
.matches(/^[a-zA-ZÀ-ÿ\s'-]+$/) .matches(/^[a-zA-ZÀ-ÿąćęłńóśźżĄĆĘŁŃÓŚŹŻ\s'-]+$/)
.withMessage('Last name contains invalid characters'), .withMessage('Last name contains invalid characters'),
body('wsdcId') body('wsdcId')
.optional({ nullable: true, checkFalsy: true }) .optional({ nullable: true, checkFalsy: true })