mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
On logout, log the user out of the UI on all open tabs
I've also reworked the logic around storing the user session idle time in localStorage
This commit is contained in:
parent
f8e4fdf201
commit
f73e56439a
@ -60,7 +60,8 @@ export default
|
||||
logout: function () {
|
||||
// the following puts our primary scope up for garbage collection, which
|
||||
// should prevent content flash from the prior user.
|
||||
var scope = angular.element(document.getElementById('main-view')).scope();
|
||||
|
||||
var x, scope = angular.element(document.getElementById('main-view')).scope();
|
||||
scope.$destroy();
|
||||
//$rootScope.$destroy();
|
||||
|
||||
@ -78,6 +79,9 @@ export default
|
||||
$cookieStore.remove('lastPath');
|
||||
$rootScope.lastPath = '/home';
|
||||
}
|
||||
x = Store('sessionTime');
|
||||
x[$rootScope.current_user.id].loggedIn = false;
|
||||
Store('sessionTime', x);
|
||||
|
||||
$rootScope.lastUser = $cookieStore.get('current_user').id;
|
||||
$cookieStore.remove('token_expires');
|
||||
|
@ -32,13 +32,12 @@ export default
|
||||
timeout: null,
|
||||
|
||||
getSessionTime: function () {
|
||||
if(Store('sessionTime_'+$rootScope.current_user.id)){
|
||||
return Store('sessionTime_'+$rootScope.current_user.id);
|
||||
if(Store('sessionTime')){
|
||||
return Store('sessionTime')[$rootScope.current_user.id].time;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
isExpired: function (increase) {
|
||||
@ -72,6 +71,7 @@ export default
|
||||
},
|
||||
|
||||
expireSession: function (reason) {
|
||||
var x;
|
||||
if(reason === 'session_limit'){
|
||||
$rootScope.sessionLimitExpired = true;
|
||||
$rootScope.sessionExpired = false;
|
||||
@ -87,10 +87,21 @@ export default
|
||||
},
|
||||
|
||||
moveForward: function () {
|
||||
var tm, t;
|
||||
var tm, t, x, y;
|
||||
tm = ($AnsibleConfig.session_timeout) ? $AnsibleConfig.session_timeout : 1800;
|
||||
t = new Date().getTime() + (tm * 1000);
|
||||
Store('sessionTime_'+$rootScope.current_user.id, t);
|
||||
x = new Object({
|
||||
time: t,
|
||||
loggedIn: true
|
||||
});
|
||||
if(Store('sessionTime')){
|
||||
y = Store('sessionTime');
|
||||
}
|
||||
else {
|
||||
y = new Object();
|
||||
}
|
||||
y[$rootScope.current_user.id] = x;
|
||||
Store('sessionTime' , y);
|
||||
$rootScope.sessionExpired = false;
|
||||
$cookieStore.put('sessionExpired', false);
|
||||
this.startTimers();
|
||||
@ -149,6 +160,9 @@ export default
|
||||
}
|
||||
that.expireSession('idle');
|
||||
}
|
||||
if(Store('sessionTime')[$rootScope.current_user.id].loggedIn === false){
|
||||
that.expireSession();
|
||||
}
|
||||
|
||||
}, 1000);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user