Client - add password reset - #50

This commit is contained in:
Sam
2020-05-17 18:20:15 +02:00
parent 51d627fa1c
commit 1860cfe320
16 changed files with 348 additions and 83 deletions

View File

@ -49,9 +49,10 @@ class UserForm extends React.Component {
t,
} = this.props
const { formData } = this.state
const { token } = this.props.location.query
return (
<div>
{isLoggedIn() ? (
{isLoggedIn() || (formType === 'password reset' && !token) ? (
<Redirect to="/" />
) : (
<div>
@ -63,6 +64,9 @@ class UserForm extends React.Component {
onHandleFormChange={event => this.onHandleFormChange(event)}
handleUserFormSubmit={event => {
event.preventDefault()
if (formType === 'password reset') {
formData.token = token
}
onHandleUserFormSubmit(formData, formType)
}}
/>
@ -82,6 +86,12 @@ export default withTranslation()(
}),
dispatch => ({
onHandleUserFormSubmit: (formData, formType) => {
formType =
formType === 'password reset'
? 'password/update'
: formType === 'reset your password'
? 'password/reset-request'
: formType
dispatch(handleUserFormSubmit(formData, formType))
},
})