From aac256711605fc3801606c14eb8dc8638b30f0d2 Mon Sep 17 00:00:00 2001 From: nickago Date: Wed, 29 Jul 2015 12:18:28 -0700 Subject: Stripped obfuscating information from password change error and synchronized error slots so that only one will show at once. --- web/react/components/user_settings.jsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'web/react/components') diff --git a/web/react/components/user_settings.jsx b/web/react/components/user_settings.jsx index e1ae6da52..31bf97453 100644 --- a/web/react/components/user_settings.jsx +++ b/web/react/components/user_settings.jsx @@ -465,17 +465,17 @@ var SecurityTab = React.createClass({ var confirmPassword = this.state.confirm_password; if (currentPassword === '') { - this.setState({ password_error: "Please enter your current password" }); + this.setState({password_error: 'Please enter your current password', server_error: ''}); return; } 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; } - if (newPassword != confirmPassword) { - this.setState({ password_error: "The new passwords you entered do not match" }); + if (newPassword !== confirmPassword) { + this.setState({password_error: 'The new passwords you entered do not match', server_error: ''}); return; } @@ -488,11 +488,16 @@ var SecurityTab = React.createClass({ function(data) { this.props.updateSection(""); AsyncClient.getMe(); - this.setState({ current_password: '', new_password: '', confirm_password: '' }); + this.setState({current_password: '', new_password: '', confirm_password: ''}); }.bind(this), function(err) { - state = this.getInitialState(); - state.server_error = err; + var state = this.getInitialState(); + if (err.message) { + state.server_error = err.message; + } else { + state.server_error = err; + } + state.password_error = ''; this.setState(state); }.bind(this) ); -- cgit v1.2.3-1-g7c22