Skip to content

Commit bb67917

Browse files
authored
Merge pull request #270 from IFRCGo/fix/password-recover
fix: recover password
2 parents 74188a9 + 6b7cc45 commit bb67917

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/views/RecoverAccountConfirm/index.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import i18n from './i18n.json';
3030
import styles from './styles.module.css';
3131

3232
interface FormFields {
33-
newPassword?: string;
33+
new_password?: string;
3434
confirmPassword?: string;
3535
}
3636

@@ -55,22 +55,22 @@ function getPasswordMatchCondition(referenceVal: string | undefined) {
5555
const formSchema: FormSchema = {
5656
fields: (value): FormSchemaFields => {
5757
let baseSchema = {
58-
newPassword: {
58+
new_password: {
5959
required: true,
6060
requiredValidation: requiredStringCondition,
6161
},
6262
};
6363
baseSchema = addCondition(
6464
baseSchema,
6565
value,
66-
['newPassword'],
66+
['new_password'],
6767
['confirmPassword'],
6868
(val) => ({
6969
confirmPassword: {
7070
required: true,
7171
requiredValidation: requiredStringCondition,
7272
forceValue: undefinedValue,
73-
validations: [getPasswordMatchCondition(val?.newPassword)],
73+
validations: [getPasswordMatchCondition(val?.new_password)],
7474
},
7575
}),
7676
);
@@ -98,7 +98,7 @@ export function Component() {
9898
pending,
9999
} = useLazyRequest({
100100
method: 'POST',
101-
url: '/change_password',
101+
url: '/change_recover_password',
102102
body: (body: ChangePasswordRequestBody) => body,
103103
onSuccess: () => {
104104
navigate('login');
@@ -129,7 +129,7 @@ export function Component() {
129129
const handleChangePassword = useCallback(
130130
(formValues: FormFields) => {
131131
requestPasswordRecovery({
132-
new_password: formValues.newPassword,
132+
new_password: formValues.new_password,
133133
token,
134134
username,
135135
} as ChangePasswordRequestBody);
@@ -160,11 +160,11 @@ export function Component() {
160160
withFallbackError
161161
/>
162162
<PasswordInput
163-
name="newPassword"
163+
name="new_password"
164164
label={strings.newPassword}
165-
value={formValue.newPassword}
165+
value={formValue.new_password}
166166
onChange={setFieldValue}
167-
error={fieldError?.newPassword}
167+
error={fieldError?.new_password}
168168
disabled={pending}
169169
withAsterisk
170170
autoFocus

0 commit comments

Comments
 (0)