From 6b7cc455ab33b996f516cc58953946b5ab1b2bb5 Mon Sep 17 00:00:00 2001 From: Sameer Rai Date: Tue, 31 Oct 2023 16:17:38 +0545 Subject: [PATCH] fix: recover password --- src/views/RecoverAccountConfirm/index.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/views/RecoverAccountConfirm/index.tsx b/src/views/RecoverAccountConfirm/index.tsx index 0b6b0cacc..7817c61e8 100644 --- a/src/views/RecoverAccountConfirm/index.tsx +++ b/src/views/RecoverAccountConfirm/index.tsx @@ -30,7 +30,7 @@ import i18n from './i18n.json'; import styles from './styles.module.css'; interface FormFields { - newPassword?: string; + new_password?: string; confirmPassword?: string; } @@ -55,7 +55,7 @@ function getPasswordMatchCondition(referenceVal: string | undefined) { const formSchema: FormSchema = { fields: (value): FormSchemaFields => { let baseSchema = { - newPassword: { + new_password: { required: true, requiredValidation: requiredStringCondition, }, @@ -63,14 +63,14 @@ const formSchema: FormSchema = { baseSchema = addCondition( baseSchema, value, - ['newPassword'], + ['new_password'], ['confirmPassword'], (val) => ({ confirmPassword: { required: true, requiredValidation: requiredStringCondition, forceValue: undefinedValue, - validations: [getPasswordMatchCondition(val?.newPassword)], + validations: [getPasswordMatchCondition(val?.new_password)], }, }), ); @@ -98,7 +98,7 @@ export function Component() { pending, } = useLazyRequest({ method: 'POST', - url: '/change_password', + url: '/change_recover_password', body: (body: ChangePasswordRequestBody) => body, onSuccess: () => { navigate('login'); @@ -129,7 +129,7 @@ export function Component() { const handleChangePassword = useCallback( (formValues: FormFields) => { requestPasswordRecovery({ - new_password: formValues.newPassword, + new_password: formValues.new_password, token, username, } as ChangePasswordRequestBody); @@ -160,11 +160,11 @@ export function Component() { withFallbackError />