fix(next): adds token to reset password initialState (#13067)
### What? Adds `token` into the `initialState` for the reset password form to ensure `token` does not get passed through as `undefined`. ### Why? Currently the reset password UI is broken because `token` is not getting passed to the form state. ### How? Adds `token` to `initialState` Fixes #13040
This commit is contained in:
@@ -18,19 +18,6 @@ type Args = {
|
||||
readonly token: string
|
||||
}
|
||||
|
||||
const initialState: FormState = {
|
||||
'confirm-password': {
|
||||
initialValue: '',
|
||||
valid: false,
|
||||
value: '',
|
||||
},
|
||||
password: {
|
||||
initialValue: '',
|
||||
valid: false,
|
||||
value: '',
|
||||
},
|
||||
}
|
||||
|
||||
export const ResetPasswordForm: React.FC<Args> = ({ token }) => {
|
||||
const i18n = useTranslation()
|
||||
const {
|
||||
@@ -61,6 +48,24 @@ export const ResetPasswordForm: React.FC<Args> = ({ token }) => {
|
||||
}
|
||||
}, [adminRoute, fetchFullUser, history, loginRoute])
|
||||
|
||||
const initialState: FormState = {
|
||||
'confirm-password': {
|
||||
initialValue: '',
|
||||
valid: false,
|
||||
value: '',
|
||||
},
|
||||
password: {
|
||||
initialValue: '',
|
||||
valid: false,
|
||||
value: '',
|
||||
},
|
||||
token: {
|
||||
initialValue: token,
|
||||
valid: true,
|
||||
value: token,
|
||||
},
|
||||
}
|
||||
|
||||
return (
|
||||
<Form
|
||||
action={`${serverURL}${apiRoute}/${userSlug}/reset-password`}
|
||||
|
||||
Reference in New Issue
Block a user