// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved. // See License.txt for license information. const Utils = require('../utils/utils.jsx'); var client = require('../utils/client.jsx'); export default class PasswordResetSendLink extends React.Component { constructor(props) { super(props); this.handleSendLink = this.handleSendLink.bind(this); this.state = {}; } handleSendLink(e) { e.preventDefault(); var state = {}; var email = React.findDOMNode(this.refs.email).value.trim().toLowerCase(); if (!email || !Utils.isEmail(email)) { state.error = 'Please enter a valid email address.'; this.setState(state); return; } state.error = null; this.setState(state); var data = {}; data.email = email; data.name = this.props.teamName; client.sendPasswordReset(data, function passwordResetSent() { this.setState({error: null, updateText:
A password reset link has been sent to {email} for your {this.props.teamDisplayName} team on {window.location.hostname}.
, moreUpdateText: 'Please check your inbox.'}); $(React.findDOMNode(this.refs.reset_form)).hide(); }.bind(this), function passwordResetFailedToSend(err) { this.setState({error: err.message, update_text: null, moreUpdateText: null}); }.bind(this) ); } render() { var updateText = null; if (this.state.updateText) { updateText =