mirror of
https://github.com/ansible/awx.git
synced 2026-03-18 01:17:35 -02:30
socket disconnect on session timeout
the UI was trying to reconnect to the socket server using the previous session's auth token. I'm forcing a disconnect now when the session times out and i added 'force new conection' to true in the socket configuration so that when a new session starts it doesn't use the old auth token.
This commit is contained in:
@@ -598,7 +598,7 @@ var tower = angular.module('Tower', [
|
|||||||
|
|
||||||
// monitor socket status
|
// monitor socket status
|
||||||
checkCount = 0;
|
checkCount = 0;
|
||||||
setInterval(function() {
|
$rootScope.dashboardInterval = setInterval(function() {
|
||||||
if (sock.checkStatus() === 'error' || checkCount > 5) {
|
if (sock.checkStatus() === 'error' || checkCount > 5) {
|
||||||
// there's an error or we're stuck in a 'connecting' state. attempt to reconnect
|
// there's an error or we're stuck in a 'connecting' state. attempt to reconnect
|
||||||
$log.debug('socket status: ' + sock.checkStatus());
|
$log.debug('socket status: ' + sock.checkStatus());
|
||||||
@@ -646,8 +646,13 @@ var tower = angular.module('Tower', [
|
|||||||
$location.path('/login');
|
$location.path('/login');
|
||||||
}
|
}
|
||||||
} else if ($rootScope.sessionTimer.isExpired()) {
|
} else if ($rootScope.sessionTimer.isExpired()) {
|
||||||
|
// gets here on timeout
|
||||||
if (next.templateUrl !== (urlPrefix + 'partials/login.html')) {
|
if (next.templateUrl !== (urlPrefix + 'partials/login.html')) {
|
||||||
$rootScope.sessionTimer.expireSession();
|
$rootScope.sessionTimer.expireSession();
|
||||||
|
if($rootScope.dashboardInterval){
|
||||||
|
window.clearInterval($rootScope.dashboardInterval);
|
||||||
|
}
|
||||||
|
sock.socket.socket.disconnect();
|
||||||
$location.path('/login');
|
$location.path('/login');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -797,4 +802,3 @@ var tower = angular.module('Tower', [
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
export default tower;
|
export default tower;
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,8 @@ angular.module('SocketIO', ['AuthService', 'Utilities'])
|
|||||||
'connect timeout': 3000,
|
'connect timeout': 3000,
|
||||||
'try multiple transports': false,
|
'try multiple transports': false,
|
||||||
'max reconnection attempts': 3,
|
'max reconnection attempts': 3,
|
||||||
'reconnection limit': 3000
|
'reconnection limit': 3000,
|
||||||
|
'force new connection': true
|
||||||
});
|
});
|
||||||
|
|
||||||
self.socket.on('connection', function() {
|
self.socket.on('connection', function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user