summaryrefslogtreecommitdiffstats
path: root/web/react
diff options
context:
space:
mode:
Diffstat (limited to 'web/react')
-rw-r--r--web/react/components/setting_picture.jsx30
-rw-r--r--web/react/components/user_settings.jsx25
2 files changed, 32 insertions, 23 deletions
diff --git a/web/react/components/setting_picture.jsx b/web/react/components/setting_picture.jsx
index 6cfb74d60..fa4c8bb62 100644
--- a/web/react/components/setting_picture.jsx
+++ b/web/react/components/setting_picture.jsx
@@ -7,8 +7,8 @@ module.exports = React.createClass({
var reader = new FileReader();
var img = this.refs.image.getDOMNode();
- reader.onload = function (e) {
- $(img).attr('src', e.target.result)
+ reader.onload = function(e) {
+ $(img).attr('src', e.target.result);
};
reader.readAsDataURL(file);
@@ -25,27 +25,27 @@ module.exports = React.createClass({
var img = null;
if (this.props.picture) {
- img = (<img ref="image" className="profile-img" src=""/>);
+ img = (<img ref='image' className='profile-img' src=''/>);
} else {
- img = (<img ref="image" className="profile-img" src={this.props.src}/>);
+ img = (<img ref='image' className='profile-img' src={this.props.src}/>);
}
var self = this;
return (
- <ul className="section-max">
- <li className="col-xs-12 section-title">{this.props.title}</li>
- <li className="col-xs-offset-3 col-xs-8">
- <ul className="setting-list">
- <li className="setting-list-item">
+ <ul className='section-max'>
+ <li className='col-xs-12 section-title'>{this.props.title}</li>
+ <li className='col-xs-offset-3 col-xs-8'>
+ <ul className='setting-list'>
+ <li className='setting-list-item'>
{img}
</li>
- <li className="setting-list-item">
- { server_error }
- { client_error }
- <span className="btn btn-sm btn-primary btn-file sel-btn">Upload<input ref="input" accept=".jpg,.png,.bmp" type="file" onChange={this.props.pictureChange}/></span>
- <a className={this.props.submitActive ? "btn btn-sm btn-primary" : "btn btn-sm btn-inactive disabled"} onClick={this.props.submit}>Save</a>
- <a className="btn btn-sm theme" href="#" onClick={self.props.updateSection}>Cancel</a>
+ <li className='setting-list-item'>
+ {server_error}
+ {client_error}
+ <span className='btn btn-sm btn-primary btn-file sel-btn'>Select<input ref='input' accept='.jpg,.png,.bmp' type='file' onChange={this.props.pictureChange}/></span>
+ <a className={this.props.submitActive ? 'btn btn-sm btn-primary' : 'btn btn-sm btn-inactive disabled'} onClick={this.props.submit}>Save</a>
+ <a className='btn btn-sm theme' href='#' onClick={self.props.updateSection}>Cancel</a>
</li>
</ul>
</li>
diff --git a/web/react/components/user_settings.jsx b/web/react/components/user_settings.jsx
index e1ae6da52..902989b7b 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)
);
@@ -709,7 +714,11 @@ var GeneralTab = React.createClass({
}.bind(this),
function(err) {
state = this.getInitialState();
- state.server_error = err;
+ if(err.message) {
+ state.server_error = err.message;
+ } else {
+ state.server_error = err
+ }
this.setState(state);
}.bind(this)
);