From 36cc51708d6d48ee9e11bfa4a72317a9abec7448 Mon Sep 17 00:00:00 2001 From: Saeloun Date: Fri, 15 Mar 2024 16:12:15 +0530 Subject: [PATCH 1/2] password field bugs --- .../Authentication/ResetPassword/utils.ts | 2 +- .../Authentication/SignUp/SignUpForm.tsx | 28 ++++++------------- .../components/Authentication/SignUp/utils.ts | 6 ++-- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/app/javascript/src/components/Authentication/ResetPassword/utils.ts b/app/javascript/src/components/Authentication/ResetPassword/utils.ts index 27436df3db..f6864c4f98 100644 --- a/app/javascript/src/components/Authentication/ResetPassword/utils.ts +++ b/app/javascript/src/components/Authentication/ResetPassword/utils.ts @@ -9,7 +9,7 @@ export const resetPasswordFormValidationSchema = Yup.object().shape({ password: Yup.string() .matches(/^\S.*\S$/, "Password cannot start or end with a blank space") .matches( - /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\s\x00-\x1F\x7F])[\S\s]{8,}$/, // eslint-disable-line + /(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[_\W\s\x00-\x1F\x7F])[\S\s]{8,}$/, // eslint-disable-line "Must Contain at least 8 Characters, One Uppercase, One Lowercase, One Number and One Special Character" ) .required("Password cannot be blank"), diff --git a/app/javascript/src/components/Authentication/SignUp/SignUpForm.tsx b/app/javascript/src/components/Authentication/SignUp/SignUpForm.tsx index f2deed415a..c1421e1374 100644 --- a/app/javascript/src/components/Authentication/SignUp/SignUpForm.tsx +++ b/app/javascript/src/components/Authentication/SignUp/SignUpForm.tsx @@ -187,7 +187,11 @@ const SignUpForm = () => { setFieldError={setFieldError} setFieldValue={setFieldValue} type="password" - wrapperClassName="mb-6" + wrapperClassName={`${!errors.password && "mb-6"}`} + /> +
@@ -210,24 +214,10 @@ const SignUpForm = () => { and 1 special character

)} - {errors.confirm_password == errors.password && - (touched.password || touched.confirm_password) ? ( - - ) : ( - (errors.confirm_password || errors.password) && ( - - ) - )} +
diff --git a/app/javascript/src/components/Authentication/SignUp/utils.ts b/app/javascript/src/components/Authentication/SignUp/utils.ts index 8a8d414429..51c9cd89ab 100644 --- a/app/javascript/src/components/Authentication/SignUp/utils.ts +++ b/app/javascript/src/components/Authentication/SignUp/utils.ts @@ -24,18 +24,18 @@ export const signUpFormValidationSchema = Yup.object().shape({ password: Yup.string() .matches(/^\S.*\S$/, "Password cannot start or end with a blank space") .matches( - /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\s\x00-\x1F\x7F])[\S\s]{8,}$/, // eslint-disable-line + /(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[_\W\s\x00-\x1F\x7F])[\S\s]{8,}$/, // eslint-disable-line "Must Contain at least 8 Characters, One Uppercase, One Lowercase, One Number and One Special Character" ) .required("Password cannot be blank"), confirm_password: Yup.string() .matches(/^\S.*\S$/, "Password cannot start or end with a blank space") .matches( - /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\s\x00-\x1F\x7F])[\S\s]{8,}$/, // eslint-disable-line + /(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[_\W\s\x00-\x1F\x7F])[\S\s]{8,}$/, // eslint-disable-line "Must Contain at least 8 Characters, One Uppercase, One Lowercase, One Number and One Special Character" ) .oneOf([Yup.ref("password"), null], "Passwords must match") - .required("Password cannot be blank"), + .required("Confirm Password cannot be blank"), isAgreedTermsOfServices: Yup.boolean().oneOf( [true], "Please agree to the terms and privacy policy to continue" From 223f2f6b5dc60c021deba1830f35df6e2a939193 Mon Sep 17 00:00:00 2001 From: Shruti Apte Date: Thu, 21 Mar 2024 10:07:12 +0530 Subject: [PATCH 2/2] whitespace character removed --- .../src/components/Authentication/ResetPassword/utils.ts | 2 +- app/javascript/src/components/Authentication/SignUp/utils.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/javascript/src/components/Authentication/ResetPassword/utils.ts b/app/javascript/src/components/Authentication/ResetPassword/utils.ts index f6864c4f98..cc153e4ff9 100644 --- a/app/javascript/src/components/Authentication/ResetPassword/utils.ts +++ b/app/javascript/src/components/Authentication/ResetPassword/utils.ts @@ -9,7 +9,7 @@ export const resetPasswordFormValidationSchema = Yup.object().shape({ password: Yup.string() .matches(/^\S.*\S$/, "Password cannot start or end with a blank space") .matches( - /(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[_\W\s\x00-\x1F\x7F])[\S\s]{8,}$/, // eslint-disable-line + /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[_\w\s\x00-\x1F\x7F])[\S]{8,}$/, // eslint-disable-line "Must Contain at least 8 Characters, One Uppercase, One Lowercase, One Number and One Special Character" ) .required("Password cannot be blank"), diff --git a/app/javascript/src/components/Authentication/SignUp/utils.ts b/app/javascript/src/components/Authentication/SignUp/utils.ts index 51c9cd89ab..9209830720 100644 --- a/app/javascript/src/components/Authentication/SignUp/utils.ts +++ b/app/javascript/src/components/Authentication/SignUp/utils.ts @@ -31,7 +31,7 @@ export const signUpFormValidationSchema = Yup.object().shape({ confirm_password: Yup.string() .matches(/^\S.*\S$/, "Password cannot start or end with a blank space") .matches( - /(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[_\W\s\x00-\x1F\x7F])[\S\s]{8,}$/, // eslint-disable-line + /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[_\w\s\x00-\x1F\x7F])[\S]{8,}$/, // eslint-disable-line "Must Contain at least 8 Characters, One Uppercase, One Lowercase, One Number and One Special Character" ) .oneOf([Yup.ref("password"), null], "Passwords must match")