summaryrefslogtreecommitdiffstats
path: root/web/react/components/user_settings_security.jsx
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-09-02 16:57:05 -0700
committerCorey Hulen <corey@hulen.com>2015-09-02 16:57:05 -0700
commit2c06ec89feb783d10fa10c77ab4b192522e35f3d (patch)
treee4ebd6b5ea7358416394848da0e4becb7dda6cd3 /web/react/components/user_settings_security.jsx
parentf11f703158ae76f5cd3bec1f5c6226196af84c91 (diff)
parent7b70892c75aec62a7b4fa326b08fbda26d4e3262 (diff)
downloadchat-2c06ec89feb783d10fa10c77ab4b192522e35f3d.tar.gz
chat-2c06ec89feb783d10fa10c77ab4b192522e35f3d.tar.bz2
chat-2c06ec89feb783d10fa10c77ab4b192522e35f3d.zip
Merge pull request #570 from rgarmsen2295/fix-initial-state-calls
Refactor remaining uses of getInitialState and componentWillMount
Diffstat (limited to 'web/react/components/user_settings_security.jsx')
-rw-r--r--web/react/components/user_settings_security.jsx10
1 files changed, 7 insertions, 3 deletions
diff --git a/web/react/components/user_settings_security.jsx b/web/react/components/user_settings_security.jsx
index d83151cd8..6ccd09cb1 100644
--- a/web/react/components/user_settings_security.jsx
+++ b/web/react/components/user_settings_security.jsx
@@ -16,8 +16,9 @@ export default class SecurityTab extends React.Component {
this.updateNewPassword = this.updateNewPassword.bind(this);
this.updateConfirmPassword = this.updateConfirmPassword.bind(this);
this.handleClose = this.handleClose.bind(this);
+ this.setupInitialState = this.setupInitialState.bind(this);
- this.state = {currentPassword: '', newPassword: '', confirmPassword: ''};
+ this.state = this.setupInitialState();
}
submitPassword(e) {
e.preventDefault();
@@ -51,10 +52,10 @@ export default class SecurityTab extends React.Component {
function success() {
this.props.updateSection('');
AsyncClient.getMe();
- this.setState({currentPassword: '', newPassword: '', confirmPassword: ''});
+ this.setState(this.setupInitialState());
}.bind(this),
function fail(err) {
- var state = this.getInitialState();
+ var state = this.setupInitialState();
if (err.message) {
state.serverError = err.message;
} else {
@@ -88,6 +89,9 @@ export default class SecurityTab extends React.Component {
this.props.updateTab('general');
}
+ setupInitialState() {
+ return {currentPassword: '', newPassword: '', confirmPassword: ''};
+ }
componentDidMount() {
$('#user_settings').on('hidden.bs.modal', this.handleClose);
}