summaryrefslogtreecommitdiffstats
path: root/web/react/components/user_settings/user_settings_general.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'web/react/components/user_settings/user_settings_general.jsx')
-rw-r--r--web/react/components/user_settings/user_settings_general.jsx19
1 files changed, 12 insertions, 7 deletions
diff --git a/web/react/components/user_settings/user_settings_general.jsx b/web/react/components/user_settings/user_settings_general.jsx
index 962efd7a2..014038dd4 100644
--- a/web/react/components/user_settings/user_settings_general.jsx
+++ b/web/react/components/user_settings/user_settings_general.jsx
@@ -9,6 +9,7 @@ import UserStore from '../../stores/user_store.jsx';
import ErrorStore from '../../stores/error_store.jsx';
import * as Client from '../../utils/client.jsx';
+import Constants from '../../utils/constants.jsx';
import * as AsyncClient from '../../utils/async_client.jsx';
import * as Utils from '../../utils/utils.jsx';
@@ -51,7 +52,7 @@ export default class UserSettingsGeneralTab extends React.Component {
}
if (user.username === username) {
- this.setState({clientError: 'You must submit a new username.', emailError: '', serverError: ''});
+ this.updateSection('');
return;
}
@@ -66,7 +67,7 @@ export default class UserSettingsGeneralTab extends React.Component {
const nickname = this.state.nickname.trim();
if (user.nickname === nickname) {
- this.setState({clientError: 'You must submit a new nickname.', emailError: '', serverError: ''});
+ this.updateSection('');
return;
}
@@ -82,7 +83,7 @@ export default class UserSettingsGeneralTab extends React.Component {
const lastName = this.state.lastName.trim();
if (user.first_name === firstName && user.last_name === lastName) {
- this.setState({clientError: 'You must submit a new first or last name.', emailError: '', serverError: ''});
+ this.updateSection('');
return;
}
@@ -98,10 +99,6 @@ export default class UserSettingsGeneralTab extends React.Component {
const email = this.state.email.trim().toLowerCase();
const confirmEmail = this.state.confirmEmail.trim().toLowerCase();
- if (user.email === email) {
- return;
- }
-
if (email === '' || !Utils.isEmail(email)) {
this.setState({emailError: 'Please enter a valid email address.', clientError: '', serverError: ''});
return;
@@ -112,6 +109,11 @@ export default class UserSettingsGeneralTab extends React.Component {
return;
}
+ if (user.email === email) {
+ this.updateSection('');
+ return;
+ }
+
user.email = email;
this.submitUser(user, true);
}
@@ -155,6 +157,9 @@ export default class UserSettingsGeneralTab extends React.Component {
if (picture.type !== 'image/jpeg' && picture.type !== 'image/png') {
this.setState({clientError: 'Only JPG or PNG images may be used for profile pictures.'});
return;
+ } else if (picture.size > Constants.MAX_FILE_SIZE) {
+ this.setState({clientError: 'Unable to upload profile image. File is too large.'});
+ return;
}
var formData = new FormData();