mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 18:09:57 -03:30
adding last user to last path logic
in order to send the user to their last path if and only if they were the last user too.
This commit is contained in:
parent
5310d3989a
commit
d9559934b0
@ -58,7 +58,7 @@
|
||||
export function Authenticate($log, $cookieStore, $compile, $window, $rootScope, $location, Authorization, ToggleClass, Alert, Wait,
|
||||
Timer, Empty, ClearScope) {
|
||||
|
||||
var setLoginFocus, lastPath, sessionExpired, loginAgain,
|
||||
var setLoginFocus, lastPath, lastUser, sessionExpired, loginAgain,
|
||||
e, html, scope = $rootScope.$new();
|
||||
|
||||
setLoginFocus = function () {
|
||||
@ -83,6 +83,15 @@ export function Authenticate($log, $cookieStore, $compile, $window, $rootScope,
|
||||
return (Empty($rootScope.lastPath)) ? $cookieStore.get('lastPath') : $rootScope.lastPath;
|
||||
};
|
||||
|
||||
lastUser = function(){
|
||||
if(!Empty($rootScope.lastUser) && $rootScope.lastUser === $rootScope.current_user.id){
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
$log.debug('User session expired: ' + sessionExpired);
|
||||
$log.debug('Last URL: ' + lastPath());
|
||||
|
||||
@ -176,7 +185,7 @@ export function Authenticate($log, $cookieStore, $compile, $window, $rootScope,
|
||||
.success(function (data) {
|
||||
Authorization.setLicense(data);
|
||||
Wait("stop");
|
||||
if (lastPath()) {
|
||||
if (lastPath() && lastUser()) {
|
||||
// Go back to most recent navigation path
|
||||
$location.path(lastPath());
|
||||
} else {
|
||||
|
||||
@ -67,8 +67,7 @@ angular.module('AuthService', ['ngCookies', Utilities.name])
|
||||
var scope = angular.element(document.getElementById('main-view')).scope();
|
||||
scope.$destroy();
|
||||
//$rootScope.$destroy();
|
||||
$cookieStore.remove('token_expires');
|
||||
$cookieStore.remove('current_user');
|
||||
|
||||
|
||||
if($cookieStore.get('lastPath')==='/portal'){
|
||||
$cookieStore.put( 'lastPath', '/portal');
|
||||
@ -76,7 +75,7 @@ angular.module('AuthService', ['ngCookies', Utilities.name])
|
||||
}
|
||||
else if ($cookieStore.get('lastPath') !== '/home' || $cookieStore.get('lastPath') !== '/' || $cookieStore.get('lastPath') !== '/login' || $cookieStore.get('lastPath') !== '/logout'){
|
||||
// do nothing
|
||||
$rootScope.lastPath = $cookieStore.get('lastPath');
|
||||
$rootScope.lastPath = $cookieStore.get('lastPath');
|
||||
}
|
||||
else {
|
||||
// your last path was home
|
||||
@ -84,6 +83,9 @@ angular.module('AuthService', ['ngCookies', Utilities.name])
|
||||
$rootScope.lastPath = '/home';
|
||||
}
|
||||
|
||||
$rootScope.lastUser = $cookieStore.get('current_user').id;
|
||||
$cookieStore.remove('token_expires');
|
||||
$cookieStore.remove('current_user');
|
||||
$cookieStore.remove('token');
|
||||
$cookieStore.put('userLoggedIn', false);
|
||||
$cookieStore.put('sessionExpired', false);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user