diff --git a/awx/ui/client/src/app.js b/awx/ui/client/src/app.js index ab22556233..f01ca708ba 100644 --- a/awx/ui/client/src/app.js +++ b/awx/ui/client/src/app.js @@ -364,6 +364,8 @@ var tower = angular.module('Tower', [ if (!Authorization.getToken() || !Authorization.isUserLoggedIn()) { // User not authenticated, redirect to login page + $rootScope.lastPath = $location.path(); + $cookies.put('lastPath', $location.path()); $location.path('/login'); } else { var lastUser = $cookies.getObject('current_user'), diff --git a/awx/ui/client/src/login/authenticationServices/authentication.service.js b/awx/ui/client/src/login/authenticationServices/authentication.service.js index f7b8dd8666..f073040e41 100644 --- a/awx/ui/client/src/login/authenticationServices/authentication.service.js +++ b/awx/ui/client/src/login/authenticationServices/authentication.service.js @@ -103,7 +103,7 @@ export default Store('sessionTime', x); if ($cookies.getObject('current_user')) { - $rootScope.lastUser = $cookies.getObject('current_user').id; + $cookies.put( 'lastUser', $cookies.getObject('current_user').id); } ConfigService.delete(); SocketService.disconnect(); diff --git a/awx/ui/client/src/login/loginModal/loginModal.controller.js b/awx/ui/client/src/login/loginModal/loginModal.controller.js index 470ab1fd50..7003f58b10 100644 --- a/awx/ui/client/src/login/loginModal/loginModal.controller.js +++ b/awx/ui/client/src/login/loginModal/loginModal.controller.js @@ -80,7 +80,8 @@ export default ['$log', '$cookies', '$compile', '$rootScope', }; lastUser = function(){ - if(!Empty($rootScope.lastUser) && $rootScope.lastUser === $rootScope.current_user.id){ + let lastUser = $cookies.get('lastUser'); + if(!Empty(lastUser) && parseInt(lastUser) === $rootScope.current_user.id){ return true; } else {