From aaad5add260252f8663f4b29755d8ce31f477a7d Mon Sep 17 00:00:00 2001 From: Reed Garmsen Date: Wed, 29 Jul 2015 15:11:07 -0700 Subject: Added text to inform the user a session id is not available for a login attempt (no session created yet) --- web/react/components/access_history_modal.jsx | 52 ++++++++++++++------------- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/web/react/components/access_history_modal.jsx b/web/react/components/access_history_modal.jsx index 6cc8ec8a9..16768a119 100644 --- a/web/react/components/access_history_modal.jsx +++ b/web/react/components/access_history_modal.jsx @@ -15,13 +15,13 @@ function getStateFromStoresForAudits() { module.exports = React.createClass({ componentDidMount: function() { UserStore.addAuditsChangeListener(this._onChange); - $(this.refs.modal.getDOMNode()).on('shown.bs.modal', function (e) { + $(this.refs.modal.getDOMNode()).on('shown.bs.modal', function(e) { AsyncClient.getAudits(); }); var self = this; $(this.refs.modal.getDOMNode()).on('hidden.bs.modal', function(e) { - self.setState({ moreInfo: [] }); + self.setState({moreInfo: []}); }); }, componentWillUnmount: function() { @@ -36,7 +36,7 @@ module.exports = React.createClass({ handleMoreInfo: function(index) { var newMoreInfo = this.state.moreInfo; newMoreInfo[index] = true; - this.setState({ moreInfo: newMoreInfo }); + this.setState({moreInfo: newMoreInfo}); }, getInitialState: function() { var initialState = getStateFromStoresForAudits(); @@ -57,24 +57,28 @@ module.exports = React.createClass({ newDate = (
{currentHistoryDate.toDateString()}
); } + if (!currentAudit.session_id && currentAudit.action.search('/users/login') !== -1) { + currentAudit.session_id = 'N/A (Login attempt)'; + } + accessList[i] = ( -
-
{newDate}
-
-
{newHistoryDate.toLocaleTimeString(navigator.language, {hour: '2-digit', minute:'2-digit'})}
-
-
{"IP: " + currentAudit.ip_address}
- { this.state.moreInfo[i] ? +
+
{newDate}
+
+
{newHistoryDate.toLocaleTimeString(navigator.language, {hour: '2-digit', minute: '2-digit'})}
+
+
{'IP: ' + currentAudit.ip_address}
+ {this.state.moreInfo[i] ?
-
{"Session ID: " + currentAudit.session_id}
-
{"URL: " + currentAudit.action.replace("/api/v1", "")}
+
{'Session ID: ' + currentAudit.session_id}
+
{'URL: ' + currentAudit.action.replace(/\/api\/v[1-9]/, '')}
: - More info + More info }
{i < this.state.audits.length - 1 ? -
+
: null } @@ -85,17 +89,17 @@ module.exports = React.createClass({ return (
-