2016-10-12 20:25:24 +02:00
|
|
|
import React, { PropTypes } from 'react';
|
2016-11-16 19:12:36 +01:00
|
|
|
import { domOnlyProps } from '../../../utils/reduxFormUtils';
|
2016-10-12 20:25:24 +02:00
|
|
|
|
|
|
|
function ResetPasswordForm(props) {
|
|
|
|
const { fields: { email }, handleSubmit, submitting, invalid, pristine } = props;
|
|
|
|
return (
|
2016-12-19 22:49:37 +01:00
|
|
|
<form className="form" onSubmit={handleSubmit(props.initiateResetPassword.bind(this))}>
|
|
|
|
<p className="form__field">
|
|
|
|
<label htmlFor="email" className="form__label">Email used for registration</label>
|
2016-10-12 20:25:24 +02:00
|
|
|
<input
|
2016-12-19 22:49:37 +01:00
|
|
|
className="form__input"
|
2016-10-12 20:25:24 +02:00
|
|
|
aria-label="email"
|
|
|
|
type="text"
|
2016-12-19 22:49:37 +01:00
|
|
|
id="email"
|
2016-11-16 19:12:36 +01:00
|
|
|
{...domOnlyProps(email)}
|
2016-10-12 20:25:24 +02:00
|
|
|
/>
|
|
|
|
</p>
|
2016-12-19 22:49:37 +01:00
|
|
|
<input type="submit" disabled={submitting || invalid || pristine || props.user.resetPasswordInitiate} value="Send Password Reset Email" aria-label="Send email to reset password" />
|
2016-10-12 20:25:24 +02:00
|
|
|
</form>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2016-10-12 23:19:43 +02:00
|
|
|
ResetPasswordForm.propTypes = {
|
2016-10-12 20:25:24 +02:00
|
|
|
fields: PropTypes.shape({
|
|
|
|
email: PropTypes.object.isRequired
|
|
|
|
}).isRequired,
|
|
|
|
handleSubmit: PropTypes.func.isRequired,
|
|
|
|
initiateResetPassword: PropTypes.func.isRequired,
|
|
|
|
submitting: PropTypes.bool,
|
|
|
|
invalid: PropTypes.bool,
|
2016-10-19 17:34:08 +02:00
|
|
|
pristine: PropTypes.bool,
|
|
|
|
user: PropTypes.shape({
|
|
|
|
resetPasswordInitiate: PropTypes.bool
|
2017-02-22 20:29:35 +01:00
|
|
|
}).isRequired
|
|
|
|
};
|
|
|
|
|
|
|
|
ResetPasswordForm.defaultProps = {
|
|
|
|
submitting: false,
|
|
|
|
pristine: true,
|
|
|
|
invalid: false
|
2016-10-12 23:19:43 +02:00
|
|
|
};
|
2016-10-12 20:25:24 +02:00
|
|
|
|
|
|
|
export default ResetPasswordForm;
|