From a68f9d69169323bca4867382b38ac01ad4c06ac8 Mon Sep 17 00:00:00 2001 From: PiotrMatyjasik Date: Fri, 24 Mar 2023 19:23:33 +0100 Subject: [PATCH 1/3] Change regex and error --- src/features/authorization/managers/registerManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/features/authorization/managers/registerManager.ts b/src/features/authorization/managers/registerManager.ts index 1bd378e1..a0128814 100644 --- a/src/features/authorization/managers/registerManager.ts +++ b/src/features/authorization/managers/registerManager.ts @@ -24,8 +24,8 @@ export const useRegisterManager = () => { .required('Required field'), password: Yup.string() .matches( - /^[a-zA-Z0-9!@#$%^&*()_+]{8,50}$/, - 'The password must contain at least 8 characters.' + /^.{8,50}$/, + 'The password must contain between 8 and 50 characters' ) .required('Required field'), }); From a660191a9fb7edd4c0e51235d9914ec84deee170 Mon Sep 17 00:00:00 2001 From: PiotrMatyjasik Date: Sat, 25 Mar 2023 13:51:33 +0100 Subject: [PATCH 2/3] Change password length --- src/features/authorization/managers/registerManager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/features/authorization/managers/registerManager.ts b/src/features/authorization/managers/registerManager.ts index a0128814..a9628261 100644 --- a/src/features/authorization/managers/registerManager.ts +++ b/src/features/authorization/managers/registerManager.ts @@ -24,8 +24,8 @@ export const useRegisterManager = () => { .required('Required field'), password: Yup.string() .matches( - /^.{8,50}$/, - 'The password must contain between 8 and 50 characters' + /^.{8,64}$/, + 'The password must contain between 8 and 64 characters' ) .required('Required field'), }); From 6dbfed25ff4bfcac1e786269062d2b3a691455b0 Mon Sep 17 00:00:00 2001 From: Ryczko Date: Sat, 25 Mar 2023 19:17:37 +0100 Subject: [PATCH 3/3] Fix validation --- src/features/authorization/managers/registerManager.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/features/authorization/managers/registerManager.ts b/src/features/authorization/managers/registerManager.ts index a9628261..2eaa06e6 100644 --- a/src/features/authorization/managers/registerManager.ts +++ b/src/features/authorization/managers/registerManager.ts @@ -23,10 +23,8 @@ export const useRegisterManager = () => { .email('Incorrect email address') .required('Required field'), password: Yup.string() - .matches( - /^.{8,64}$/, - 'The password must contain between 8 and 64 characters' - ) + .min(8, 'Password must be at least 8 characters long') + .max(64, 'Password can be up to 64 characters long') .required('Required field'), });