From dd7247b1706d827d56d1d962786d132678ebb9ea Mon Sep 17 00:00:00 2001 From: Joana Maia Date: Mon, 20 Nov 2023 10:44:28 +0000 Subject: [PATCH] Fix signup regex --- backend/src/services/auth/authService.ts | 2 +- frontend/src/modules/user/user-model.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/services/auth/authService.ts b/backend/src/services/auth/authService.ts index e18fb9695c..6cad4692c8 100644 --- a/backend/src/services/auth/authService.ts +++ b/backend/src/services/auth/authService.ts @@ -38,7 +38,7 @@ class AuthService { const existingUser = await UserRepository.findByEmail(email, options) - const passwordRegex = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/ + const passwordRegex = /^(?=.*[A-Za-z])(?=.*\d)(?=.*[^A-Za-z\d])([^ \t]{8,})$/ if (!passwordRegex.test(password)) { throw new Error400(options.language, 'auth.passwordInvalid') diff --git a/frontend/src/modules/user/user-model.js b/frontend/src/modules/user/user-model.js index 4510a805d9..11d2039f99 100644 --- a/frontend/src/modules/user/user-model.js +++ b/frontend/src/modules/user/user-model.js @@ -31,7 +31,7 @@ const fields = { }), password: new StringField('password', label('password'), { required: true, - matches: /^(?=.*[A-Za-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]{8,}$/, + matches: /^(?=.*[A-Za-z])(?=.*\d)(?=.*[^A-Za-z\d])([^ \t]{8,})$/, }), passwordSignin: new StringField('password', label('password'), { required: true,