Portal mode authorization

Had to override the authorization controller which automatically redirects the user to hte home page if it is their first time visiting tower. I perform a check to see if the url is to /portal, and then set lastPath to portal to force it to portal mode on the first visit
This commit is contained in:
Jared Tabor
2014-11-06 14:25:48 -05:00
parent 27fd173e72
commit cacdefafbf
2 changed files with 15 additions and 2 deletions

View File

@@ -649,6 +649,10 @@ angular.module('Tower', [
$AnsibleConfig = Store('AnsibleConfig'); $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(); LoadConfig();
} }
]); ]);

View File

@@ -64,7 +64,16 @@ angular.module('AuthService', ['ngCookies', 'Utilities'])
//$rootScope.$destroy(); //$rootScope.$destroy();
$cookieStore.remove('token_expires'); $cookieStore.remove('token_expires');
$cookieStore.remove('current_user'); $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.remove('token');
$cookieStore.put('userLoggedIn', false); $cookieStore.put('userLoggedIn', false);
$cookieStore.put('sessionExpired', false); $cookieStore.put('sessionExpired', false);
@@ -75,7 +84,7 @@ angular.module('AuthService', ['ngCookies', 'Utilities'])
$rootScope.sessionExpired = false; $rootScope.sessionExpired = false;
$rootScope.token = null; $rootScope.token = null;
$rootScope.token_expires = null; $rootScope.token_expires = null;
$rootScope.lastPath = '/home';
$rootScope.login_username = null; $rootScope.login_username = null;
$rootScope.login_password = null; $rootScope.login_password = null;
}, },