diff --git a/awx/ui/static/js/app.js b/awx/ui/static/js/app.js index 1d6390c11b..ec889c0302 100644 --- a/awx/ui/static/js/app.js +++ b/awx/ui/static/js/app.js @@ -649,6 +649,10 @@ angular.module('Tower', [ $AnsibleConfig = Store('AnsibleConfig'); } + //the authorization controller redirects to the home page automatcially if there is no last path defined. in order to override + // this, set the last path to /portal for instances where portal is visited for the first time. + $rootScope.lastPath = ($location.path() === "/portal") ? 'portal' : undefined; + LoadConfig(); } ]); diff --git a/awx/ui/static/lib/ansible/AuthService.js b/awx/ui/static/lib/ansible/AuthService.js index c782292e8a..2094df56fd 100644 --- a/awx/ui/static/lib/ansible/AuthService.js +++ b/awx/ui/static/lib/ansible/AuthService.js @@ -64,7 +64,16 @@ angular.module('AuthService', ['ngCookies', 'Utilities']) //$rootScope.$destroy(); $cookieStore.remove('token_expires'); $cookieStore.remove('current_user'); - $cookieStore.remove('lastPath'); + + if($cookieStore.get('lastPath')==='/portal'){ + $cookieStore.put( 'lastPath', '/portal'); + $rootScope.lastPath = '/portal'; + } + else { + $cookieStore.remove('lastPath'); + $rootScope.lastPath = '/home'; + } + $cookieStore.remove('token'); $cookieStore.put('userLoggedIn', false); $cookieStore.put('sessionExpired', false); @@ -75,7 +84,7 @@ angular.module('AuthService', ['ngCookies', 'Utilities']) $rootScope.sessionExpired = false; $rootScope.token = null; $rootScope.token_expires = null; - $rootScope.lastPath = '/home'; + $rootScope.login_username = null; $rootScope.login_password = null; },