summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornickago <ngonella@calpoly.edu>2015-07-29 12:18:28 -0700
committernickago <ngonella@calpoly.edu>2015-07-29 12:18:28 -0700
commitaac256711605fc3801606c14eb8dc8638b30f0d2 (patch)
treece56a1253ff03e622f27ea4f8a2cd691361d68b3
parent54265271fa16c624570ff89a26ae8596cf0fafc7 (diff)
downloadchat-aac256711605fc3801606c14eb8dc8638b30f0d2.tar.gz
chat-aac256711605fc3801606c14eb8dc8638b30f0d2.tar.bz2
chat-aac256711605fc3801606c14eb8dc8638b30f0d2.zip
Stripped obfuscating information from password change error and synchronized error slots so that only one will show at once.
-rw-r--r--web/react/components/user_settings.jsx19
1 files changed, 12 insertions, 7 deletions
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)
);