2019-07-23 20:16:05 +02:00
|
|
|
|
2018-02-07 19:06:07 +01:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import React from 'react';
|
2019-09-19 19:38:27 +02:00
|
|
|
import { Link } from 'react-router';
|
2017-02-22 20:29:35 +01:00
|
|
|
import classNames from 'classnames';
|
2016-12-19 22:49:37 +01:00
|
|
|
import { bindActionCreators } from 'redux';
|
|
|
|
import { reduxForm } from 'redux-form';
|
2018-02-23 17:31:41 +01:00
|
|
|
import { Helmet } from 'react-helmet';
|
2017-02-22 20:29:35 +01:00
|
|
|
import * as UserActions from '../actions';
|
2016-12-19 22:49:37 +01:00
|
|
|
import ResetPasswordForm from '../components/ResetPasswordForm';
|
2019-07-23 20:16:05 +02:00
|
|
|
import { validateResetPassword } from '../../../utils/reduxFormUtils';
|
2019-09-19 19:38:27 +02:00
|
|
|
import Nav from '../../../components/Nav';
|
2017-02-22 20:29:35 +01:00
|
|
|
|
2019-09-19 19:38:27 +02:00
|
|
|
function ResetPasswordView(props) {
|
|
|
|
const resetPasswordClass = classNames({
|
|
|
|
'reset-password': true,
|
|
|
|
'reset-password--submitted': props.user.resetPasswordInitiate,
|
|
|
|
'form-container': true,
|
|
|
|
'user': true
|
|
|
|
});
|
|
|
|
return (
|
|
|
|
<div className="reset-password-container">
|
|
|
|
<Nav layout="dashboard" />
|
|
|
|
<div className={resetPasswordClass}>
|
|
|
|
<Helmet>
|
|
|
|
<title>p5.js Web Editor | Reset Password</title>
|
|
|
|
</Helmet>
|
|
|
|
<div className="form-container__content">
|
|
|
|
<h2 className="form-container__title">Reset Your Password</h2>
|
|
|
|
<ResetPasswordForm {...props} />
|
|
|
|
<p className="reset-password__submitted">
|
|
|
|
Your password reset email should arrive shortly. If you don't see it, check
|
|
|
|
in your spam folder as sometimes it can end up there.
|
|
|
|
</p>
|
|
|
|
<p className="form__navigation-options">
|
|
|
|
<Link className="form__login-button" to="/login">Log In</Link>
|
|
|
|
or
|
|
|
|
<Link className="form__signup-button" to="/signup">Sign Up</Link>
|
|
|
|
</p>
|
2016-12-19 22:49:37 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-09-19 19:38:27 +02:00
|
|
|
</div>
|
|
|
|
);
|
2016-12-19 22:49:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ResetPasswordView.propTypes = {
|
|
|
|
resetPasswordReset: PropTypes.func.isRequired,
|
|
|
|
user: PropTypes.shape({
|
|
|
|
resetPasswordInitiate: PropTypes.bool
|
|
|
|
}).isRequired,
|
|
|
|
};
|
|
|
|
|
|
|
|
function mapStateToProps(state) {
|
|
|
|
return {
|
|
|
|
user: state.user
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function mapDispatchToProps(dispatch) {
|
|
|
|
return bindActionCreators(UserActions, dispatch);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default reduxForm({
|
|
|
|
form: 'reset-password',
|
|
|
|
fields: ['email'],
|
2019-07-23 20:16:05 +02:00
|
|
|
validate: validateResetPassword
|
2016-12-19 22:49:37 +01:00
|
|
|
}, mapStateToProps, mapDispatchToProps)(ResetPasswordView);
|