import React from 'react'; import { Row, Col, Alert, FormGroup, ControlLabel, Button } from 'react-bootstrap'; import PropTypes from 'prop-types'; import { Link } from 'react-router-dom'; import { Accounts } from 'meteor/accounts-base'; import { Bert } from 'meteor/themeteorchef:bert'; import AccountPageFooter from '../../components/AccountPageFooter/AccountPageFooter'; import validate from '../../../modules/validate'; class RecoverPassword extends React.Component { constructor(props) { super(props); this.handleSubmit = this.handleSubmit.bind(this); } componentDidMount() { const component = this; validate(component.form, { rules: { emailAddress: { required: true, email: true, }, }, messages: { emailAddress: { required: 'Need an email address here.', email: 'Is this email address correct?', }, }, submitHandler() { component.handleSubmit(); }, }); } handleSubmit() { const { history } = this.props; const email = this.emailAddress.value; Accounts.forgotPassword({ email }, (error) => { if (error) { Bert.alert(error.reason, 'danger'); } else { Bert.alert(`Check ${email} for a reset link!`, 'success'); history.push('/login'); } }); } render() { return (