// Copyright (c) 2015 Spinpunch, Inc. All Rights Reserved.
// See License.txt for license information.
var utils = require('../utils/utils.jsx');
var client = require('../utils/client.jsx');
var UserStore = require('../stores/user_store.jsx');
SendResetPasswordLink = React.createClass({
handleSendLink: function(e) {
e.preventDefault();
var state = {};
var domain = this.refs.domain.getDOMNode().value.trim();
if (!domain) {
state.error = "A domain is required"
this.setState(state);
return;
}
var email = this.refs.email.getDOMNode().value.trim();
if (!email) {
state.error = "Please enter a valid email address."
this.setState(state);
return;
}
state.error = null;
this.setState(state);
data = {};
data['email'] = email;
data['domain'] = domain;
client.sendPasswordReset(data,
function(data) {
this.setState({ error: null, update_text:
A password reset link has been sent to {email} for your {this.props.teamName} team on {config.SiteName}.com.