diff options
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/access_history_modal.jsx | 30 | ||||
-rw-r--r-- | web/react/components/user_settings.jsx | 5 |
2 files changed, 20 insertions, 15 deletions
diff --git a/web/react/components/access_history_modal.jsx b/web/react/components/access_history_modal.jsx index fecb11c7d..678113a47 100644 --- a/web/react/components/access_history_modal.jsx +++ b/web/react/components/access_history_modal.jsx @@ -13,22 +13,23 @@ function getStateFromStoresForAudits() { } module.exports = React.createClass({ + displayName: 'AccessHistoryModal', componentDidMount: function() { - UserStore.addAuditsChangeListener(this._onChange); - $(this.refs.modal.getDOMNode()).on('shown.bs.modal', function(e) { + UserStore.addAuditsChangeListener(this.onListenerChange); + $(this.refs.modal.getDOMNode()).on('shown.bs.modal', function() { AsyncClient.getAudits(); }); var self = this; - $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', function(e) { + $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', function() { $('#user_settings1').modal('show'); self.setState({moreInfo: []}); }); }, componentWillUnmount: function() { - UserStore.removeAuditsChangeListener(this._onChange); + UserStore.removeAuditsChangeListener(this.onListenerChange); }, - _onChange: function() { + onListenerChange: function() { var newState = getStateFromStoresForAudits(); if (!utils.areStatesEqual(newState.audits, this.state.audits)) { this.setState(newState); @@ -62,6 +63,16 @@ module.exports = React.createClass({ currentAudit.session_id = 'N/A (Login attempt)'; } + var moreInfo = (<a href='#' className='theme' onClick={this.handleMoreInfo.bind(this, i)}>More info</a>); + if (this.state.moreInfo[i]) { + moreInfo = ( + <div> + <div>{'Session ID: ' + currentAudit.session_id}</div> + <div>{'URL: ' + currentAudit.action.replace(/\/api\/v[1-9]/, '')}</div> + </div> + ); + } + accessList[i] = ( <div className='access-history__table'> <div className='access__date'>{newDate}</div> @@ -69,14 +80,7 @@ module.exports = React.createClass({ <div className='report__time'>{newHistoryDate.toLocaleTimeString(navigator.language, {hour: '2-digit', minute: '2-digit'})}</div> <div className='report__info'> <div>{'IP: ' + currentAudit.ip_address}</div> - {this.state.moreInfo[i] ? - <div> - <div>{'Session ID: ' + currentAudit.session_id}</div> - <div>{'URL: ' + currentAudit.action.replace(/\/api\/v[1-9]/, '')}</div> - </div> - : - <a href='#' className='theme' onClick={this.handleMoreInfo.bind(this, i)}>More info</a> - } + {moreInfo} </div> {i < this.state.audits.length - 1 ? <div className='divider-light'/> diff --git a/web/react/components/user_settings.jsx b/web/react/components/user_settings.jsx index d0ce23639..ed4f3fd98 100644 --- a/web/react/components/user_settings.jsx +++ b/web/react/components/user_settings.jsx @@ -524,12 +524,13 @@ var SecurityTab = React.createClass({ $(this.getDOMNode()).find('.form-control').each(function() { this.value = ''; }); + this.setState({current_password: '', new_password: '', confirm_password: '', server_error: null, password_error: null}); if (!this.state.willReturn) { this.props.updateTab('general'); + } else { + this.setState({willReturn: false}); } - - 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); |