import React from 'react'; import { Row, Alert, FormGroup, ControlLabel, Button } from 'react-bootstrap'; import Col from '../../components/Col/Col'; 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'; import { translate } from 'react-i18next'; class RecoverPassword extends React.Component { constructor(props) { super(props); this.t = props.t; 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; const t = this.props.t; Accounts.forgotPassword({ email, t }, (error) => { if (error) { Bert.alert(error.reason, 'danger'); } else { Bert.alert(t("checkResetEmail", {email: email}), 'success'); history.push('/login'); } }); } render() { return (