From fbd0f03eb2cb6d3b25f65559e21589c415cbdbec Mon Sep 17 00:00:00 2001 From: donpat1to Date: Wed, 29 Oct 2025 11:12:37 +0100 Subject: [PATCH] password requirements allow more special chars --- backend/src/middleware/validation.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/backend/src/middleware/validation.ts b/backend/src/middleware/validation.ts index 26b3c2d..a1a9620 100644 --- a/backend/src/middleware/validation.ts +++ b/backend/src/middleware/validation.ts @@ -12,8 +12,8 @@ export const validateLogin = [ .optional() .isLength({ min: 8 }) .withMessage('Password must be at least 8 characters') - .matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])/) - .withMessage('Password must contain uppercase, lowercase, number and special character (@$!%*?&)'), + .matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?])/) + .withMessage('Password must contain uppercase, lowercase, number and special character'), ]; export const validateRegister = [ @@ -33,8 +33,8 @@ export const validateRegister = [ .optional() .isLength({ min: 8 }) .withMessage('Password must be at least 8 characters') - .matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])/) - .withMessage('Password must contain uppercase, lowercase, number and special character (@$!%*?&)'), + .matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?])/) + .withMessage('Password must contain uppercase, lowercase, number and special character'), ]; // ===== EMPLOYEE VALIDATION ===== @@ -55,8 +55,8 @@ export const validateEmployee = [ .optional() .isLength({ min: 8 }) .withMessage('Password must be at least 8 characters') - .matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])/) - .withMessage('Password must contain uppercase, lowercase, number and special character (@$!%*?&)'), + .matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?])/) + .withMessage('Password must contain uppercase, lowercase, number and special character'), body('employeeType') .isIn(['manager', 'personell', 'apprentice', 'guest']) @@ -154,8 +154,8 @@ export const validateChangePassword = [ .optional() .isLength({ min: 8 }) .withMessage('Password must be at least 8 characters') - .matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])/) - .withMessage('Password must contain uppercase, lowercase, number and special character (@$!%*?&)'), + .matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?])/) + .withMessage('Password must contain uppercase, lowercase, number and special character'), ]; // ===== SHIFT PLAN VALIDATION ===== @@ -346,8 +346,8 @@ export const validateSetupAdmin = [ .optional() .isLength({ min: 8 }) .withMessage('Password must be at least 8 characters') - .matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])/) - .withMessage('Password must contain uppercase, lowercase, number and special character (@$!%*?&)'), + .matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?])/) + .withMessage('Password must contain uppercase, lowercase, number and special character'), ]; // ===== SCHEDULING VALIDATION =====