p5.js-web-editor/client/modules/IDE/components/ResetPasswordView.js

50 lines
1.2 KiB
JavaScript
Raw Normal View History

2016-10-12 18:02:46 +02:00
import React from 'react';
import { Link } from 'react-router';
2016-10-12 20:25:24 +02:00
import * as UserActions from '../../User/actions';
import { bindActionCreators } from 'redux';
import { reduxForm } from 'redux-form';
import ResetPasswordForm from './ResetPasswordForm';
2016-10-12 18:02:46 +02:00
class ResetPasswordView extends React.Component {
componentDidMount() {
2016-10-12 20:25:24 +02:00
this.refs.resetPassword.focus();
2016-10-12 18:02:46 +02:00
}
render() {
return (
2016-10-12 20:25:24 +02:00
<div className="reset-password" ref="resetPassword" tabIndex="0">
<h1>Reset Your Password</h1>
<ResetPasswordForm {...this.props} />
2016-10-12 18:02:46 +02:00
<Link className="form__login-button" to="/login">Login</Link>
or
<Link className="form__signup-button" to="/signup">Sign up</Link>
<Link className="form__cancel-button" to="/">Cancel</Link>
</div>
);
}
2016-10-12 20:25:24 +02:00
}
function mapStateToProps(state) {
return {
user: state.user
};
}
function mapDispatchToProps(dispatch) {
return bindActionCreators(UserActions, dispatch);
}
function validate(formProps) {
const errors = {};
if (!formProps.email) {
errors.email = 'Please enter an email'
}
return errors;
}
export default reduxForm({
form: 'reset-password',
fields: 'email',
validate
}, mapStateToProps, mapDispatchToProps)(ResetPasswordView);