// 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 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['name'] = this.props.teamName; client.sendPasswordReset(data, function(data) { this.setState({ error: null, update_text:

A password reset link has been sent to {email} for your {this.props.teamDisplayName} team on {window.location.hostname}.

, more_update_text: "Please check your inbox." }); $(this.refs.reset_form.getDOMNode()).hide(); }.bind(this), function(err) { this.setState({ error: err.message, update_text: null, more_update_text: null }); }.bind(this) ); }, getInitialState: function() { return {}; }, render: function() { var update_text = this.state.update_text ?
{this.state.update_text}{this.state.more_update_text}
: null; var error = this.state.error ?
: null; return (

Password Reset

{ update_text }

{"To reset your password, enter the email address you used to sign up for " + this.props.teamDisplayName + "."}

{ error }
); } }); ResetPassword = React.createClass({ handlePasswordReset: function(e) { e.preventDefault(); var state = {}; var password = this.refs.password.getDOMNode().value.trim(); if (!password || password.length < 5) { state.error = "Please enter at least 5 characters." this.setState(state); return; } state.error = null; this.setState(state); data = {}; data['new_password'] = password; data['hash'] = this.props.hash; data['data'] = this.props.data; data['name'] = this.props.teamName; client.resetPassword(data, function(data) { this.setState({ error: null, update_text: "Your password has been updated successfully." }); }.bind(this), function(err) { this.setState({ error: err.message, update_text: null }); }.bind(this) ); }, getInitialState: function() { return {}; }, render: function() { var update_text = this.state.update_text ?

: null; var error = this.state.error ?
: null; return (

Password Reset

{"Enter a new password for your " + this.props.teamDisplayName + " " + config.SiteName + " account."}

{ error } { update_text }
); } }); module.exports = React.createClass({ getInitialState: function() { return {}; }, render: function() { if (this.props.isReset === "false") { return ( ); } else { return ( ); } } });