From 739aa11c0837129746c4660faa4c893e5a7f1a51 Mon Sep 17 00:00:00 2001 From: Melissa 't Hart Date: Thu, 28 Mar 2024 12:42:24 +0100 Subject: [PATCH 1/2] fix(project): old password form error after validation --- .../src/components/EditPasswordForm/EditPasswordForm.tsx | 5 ++++- .../__snapshots__/EditPasswordForm.test.tsx.snap | 2 ++ .../ui-react/src/components/PasswordField/PasswordField.tsx | 2 +- .../src/containers/AccountModal/forms/EditPassword.tsx | 2 ++ platforms/web/public/locales/en/account.json | 1 + platforms/web/public/locales/es/account.json | 3 ++- 6 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/ui-react/src/components/EditPasswordForm/EditPasswordForm.tsx b/packages/ui-react/src/components/EditPasswordForm/EditPasswordForm.tsx index 5aa41f030..8413310ac 100644 --- a/packages/ui-react/src/components/EditPasswordForm/EditPasswordForm.tsx +++ b/packages/ui-react/src/components/EditPasswordForm/EditPasswordForm.tsx @@ -43,7 +43,7 @@ const EditPasswordForm: React.FC = ({ }: Props) => { const { t } = useTranslation(['account', 'user']); return ( -
+ {errors.form && ( {errors.form} @@ -69,6 +69,7 @@ const EditPasswordForm: React.FC = ({ name="oldPassword" showToggleView={false} showHelperText={false} + autoComplete="current-password" required /> )} @@ -95,6 +96,7 @@ const EditPasswordForm: React.FC = ({ placeholder={t('reset.password')} error={!!errors.password} name="password" + autoComplete="new-password" required /> @@ -106,6 +108,7 @@ const EditPasswordForm: React.FC = ({ placeholder={t('reset.repeat_new_password')} error={!!errors.passwordConfirmation} name="passwordConfirmation" + autoComplete="new-password" required /> diff --git a/packages/ui-react/src/components/EditPasswordForm/__snapshots__/EditPasswordForm.test.tsx.snap b/packages/ui-react/src/components/EditPasswordForm/__snapshots__/EditPasswordForm.test.tsx.snap index 6158f4261..154c0b47c 100644 --- a/packages/ui-react/src/components/EditPasswordForm/__snapshots__/EditPasswordForm.test.tsx.snap +++ b/packages/ui-react/src/components/EditPasswordForm/__snapshots__/EditPasswordForm.test.tsx.snap @@ -26,6 +26,7 @@ exports[` > renders and matches snapshot 1`] = ` > renders and matches snapshot 1`] = ` & { onChange?: React.ChangeEventHandler; onBlur?: React.FocusEventHandler; error?: boolean; diff --git a/packages/ui-react/src/containers/AccountModal/forms/EditPassword.tsx b/packages/ui-react/src/containers/AccountModal/forms/EditPassword.tsx index 50321cc8a..22c54a2ba 100644 --- a/packages/ui-react/src/containers/AccountModal/forms/EditPassword.tsx +++ b/packages/ui-react/src/containers/AccountModal/forms/EditPassword.tsx @@ -59,6 +59,8 @@ const ResetPassword = ({ type }: { type?: 'add' }) => { setErrors({ form: t('reset.invalid_reset_link') }); } else if (error.message.includes('score does not match standards')) { setErrors({ form: t('reset.password_strength') }); + } else if (error.message.includes('old password does not match')) { + setErrors({ form: t('reset.old_password_does_not_match') }); } else if (error.message.includes('password could not be set')) { setErrors({ form: t('reset.invalid_token') }); } diff --git a/platforms/web/public/locales/en/account.json b/platforms/web/public/locales/en/account.json index af22d14b7..eb6e36362 100644 --- a/platforms/web/public/locales/en/account.json +++ b/platforms/web/public/locales/en/account.json @@ -195,6 +195,7 @@ "password_reset_text": "", "password_strength": "Although your password meets the criteria for a strong password, it includes elements that are not advisable, such as prohibited phrases or repeated words. Please modify it to ensure account safety.", "passwords_do_not_match": "Passwords do not match", + "old_password_does_not_match": "Old password does not match", "repeat_new_password": "Repeat new password", "reset_password": "Edit Password", "reset_password_token": "Token", diff --git a/platforms/web/public/locales/es/account.json b/platforms/web/public/locales/es/account.json index 996819818..e6d183c3c 100644 --- a/platforms/web/public/locales/es/account.json +++ b/platforms/web/public/locales/es/account.json @@ -204,7 +204,8 @@ "password_reset_success": "Contraseña restablecida", "password_reset_text": "", "password_strength": "Aunque tu contraseña cumple con los criterios de una contraseña segura, incluye elementos que no son recomendables, como frases prohibidas o palabras repetidas. Por favor, modifícala para garantizar la seguridad de tu cuenta.", - "passwords_do_not_match": "Las contraseñas no coinciden", + "passwords_do_not_match": "La contraseña antigua no coincide", + "old_password_does_not_match": "Las contraseñas no coinciden", "repeat_new_password": "Repetir nueva contraseña", "reset_password": "Editar contraseña", "reset_password_token": "Token", From 715f4731de7bfd6ccdfb8ffa9f14768a25c77df3 Mon Sep 17 00:00:00 2001 From: Melissa 't Hart Date: Thu, 28 Mar 2024 14:15:33 +0100 Subject: [PATCH 2/2] chore(project): correct translations --- platforms/web/public/locales/es/account.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platforms/web/public/locales/es/account.json b/platforms/web/public/locales/es/account.json index e6d183c3c..fb8a6bf80 100644 --- a/platforms/web/public/locales/es/account.json +++ b/platforms/web/public/locales/es/account.json @@ -204,8 +204,8 @@ "password_reset_success": "Contraseña restablecida", "password_reset_text": "", "password_strength": "Aunque tu contraseña cumple con los criterios de una contraseña segura, incluye elementos que no son recomendables, como frases prohibidas o palabras repetidas. Por favor, modifícala para garantizar la seguridad de tu cuenta.", - "passwords_do_not_match": "La contraseña antigua no coincide", - "old_password_does_not_match": "Las contraseñas no coinciden", + "passwords_do_not_match": "Las contraseñas no coinciden", + "old_password_does_not_match": "La contraseña antigua no coincide", "repeat_new_password": "Repetir nueva contraseña", "reset_password": "Editar contraseña", "reset_password_token": "Token",