From e01cae5c0965371efa8179abf10434d12dfd5843 Mon Sep 17 00:00:00 2001
From: nickago <ngonella@calpoly.edu>
Date: Fri, 7 Aug 2015 09:41:14 -0700
Subject: access history and activity log closing re-opens user settings in
 correct state

---
 web/react/components/user_settings.jsx | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

(limited to 'web/react/components/user_settings.jsx')

diff --git a/web/react/components/user_settings.jsx b/web/react/components/user_settings.jsx
index 1a0c313d3..d0ce23639 100644
--- a/web/react/components/user_settings.jsx
+++ b/web/react/components/user_settings.jsx
@@ -513,17 +513,23 @@ var SecurityTab = React.createClass({
         this.setState({confirmPassword: e.target.value});
     },
     handleHistoryOpen: function() {
-        $('#user_settings1').modal('hide');
+        this.setState({willReturn: true});
+        $("#user_settings1").modal('hide');
     },
     handleDevicesOpen: function() {
-        $('#user_settings1').modal('hide');
+        this.setState({willReturn: true});
+        $("#user_settings1").modal('hide');
     },
     handleClose: function() {
         $(this.getDOMNode()).find('.form-control').each(function() {
             this.value = '';
         });
-        this.setState({currentPassword: '', newPassword: '', confirmPassword: '', serverError: null, passwordError: null});
-        this.props.updateTab('general');
+
+        if (!this.state.willReturn) {
+            this.props.updateTab('general');
+        }
+
+        this.setState({current_password: '', new_password: '', confirm_password: '', server_error: null, password_error: null, willReturn: false});
     },
     componentDidMount: function() {
         $('#user_settings1').on('hidden.bs.modal', this.handleClose);
@@ -533,7 +539,7 @@ var SecurityTab = React.createClass({
         this.props.updateSection('');
     },
     getInitialState: function() {
-        return {currentPassword: '', newPassword: '', confirmPassword: ''};
+        return { current_password: '', new_password: '', confirm_password: '', willReturn: false };
     },
     render: function() {
         var serverError = this.state.serverError ? this.state.serverError : null;
-- 
cgit v1.2.3-1-g7c22

