Merge pull request #282 from nickago/MM-1642

MM-1642 Updated the password error message to not contain extraneous information
Этот коммит содержится в:
Christopher Speller
2015-07-30 08:51:00 -04:00
родитель 4646c22ef1 aac2567116
Коммит 51e244ab5a

Просмотреть файл

@@ -465,17 +465,17 @@ var SecurityTab = React.createClass({
var confirmPassword = this.state.confirm_password; var confirmPassword = this.state.confirm_password;
if (currentPassword === '') { if (currentPassword === '') {
this.setState({ password_error: "Please enter your current password" }); this.setState({password_error: 'Please enter your current password', server_error: ''});
return; return;
} }
if (newPassword.length < 5) { if (newPassword.length < 5) {
this.setState({ password_error: "New passwords must be at least 5 characters" }); this.setState({password_error: 'New passwords must be at least 5 characters', server_error: ''});
return; return;
} }
if (newPassword != confirmPassword) { if (newPassword !== confirmPassword) {
this.setState({ password_error: "The new passwords you entered do not match" }); this.setState({password_error: 'The new passwords you entered do not match', server_error: ''});
return; return;
} }
@@ -488,11 +488,16 @@ var SecurityTab = React.createClass({
function(data) { function(data) {
this.props.updateSection(""); this.props.updateSection("");
AsyncClient.getMe(); AsyncClient.getMe();
this.setState({ current_password: '', new_password: '', confirm_password: '' }); this.setState({current_password: '', new_password: '', confirm_password: ''});
}.bind(this), }.bind(this),
function(err) { function(err) {
state = this.getInitialState(); var state = this.getInitialState();
state.server_error = err; if (err.message) {
state.server_error = err.message;
} else {
state.server_error = err;
}
state.password_error = '';
this.setState(state); this.setState(state);
}.bind(this) }.bind(this)
); );