mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02: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:
@@ -58,7 +58,7 @@
|
|||||||
export function Authenticate($log, $cookieStore, $compile, $window, $rootScope, $location, Authorization, ToggleClass, Alert, Wait,
|
export function Authenticate($log, $cookieStore, $compile, $window, $rootScope, $location, Authorization, ToggleClass, Alert, Wait,
|
||||||
Timer, Empty, ClearScope) {
|
Timer, Empty, ClearScope) {
|
||||||
|
|
||||||
var setLoginFocus, lastPath, sessionExpired, loginAgain,
|
var setLoginFocus, lastPath, lastUser, sessionExpired, loginAgain,
|
||||||
e, html, scope = $rootScope.$new();
|
e, html, scope = $rootScope.$new();
|
||||||
|
|
||||||
setLoginFocus = function () {
|
setLoginFocus = function () {
|
||||||
@@ -83,6 +83,15 @@ export function Authenticate($log, $cookieStore, $compile, $window, $rootScope,
|
|||||||
return (Empty($rootScope.lastPath)) ? $cookieStore.get('lastPath') : $rootScope.lastPath;
|
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('User session expired: ' + sessionExpired);
|
||||||
$log.debug('Last URL: ' + lastPath());
|
$log.debug('Last URL: ' + lastPath());
|
||||||
|
|
||||||
@@ -176,7 +185,7 @@ export function Authenticate($log, $cookieStore, $compile, $window, $rootScope,
|
|||||||
.success(function (data) {
|
.success(function (data) {
|
||||||
Authorization.setLicense(data);
|
Authorization.setLicense(data);
|
||||||
Wait("stop");
|
Wait("stop");
|
||||||
if (lastPath()) {
|
if (lastPath() && lastUser()) {
|
||||||
// Go back to most recent navigation path
|
// Go back to most recent navigation path
|
||||||
$location.path(lastPath());
|
$location.path(lastPath());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -67,8 +67,7 @@ angular.module('AuthService', ['ngCookies', Utilities.name])
|
|||||||
var scope = angular.element(document.getElementById('main-view')).scope();
|
var scope = angular.element(document.getElementById('main-view')).scope();
|
||||||
scope.$destroy();
|
scope.$destroy();
|
||||||
//$rootScope.$destroy();
|
//$rootScope.$destroy();
|
||||||
$cookieStore.remove('token_expires');
|
|
||||||
$cookieStore.remove('current_user');
|
|
||||||
|
|
||||||
if($cookieStore.get('lastPath')==='/portal'){
|
if($cookieStore.get('lastPath')==='/portal'){
|
||||||
$cookieStore.put( 'lastPath', '/portal');
|
$cookieStore.put( 'lastPath', '/portal');
|
||||||
@@ -84,6 +83,9 @@ angular.module('AuthService', ['ngCookies', Utilities.name])
|
|||||||
$rootScope.lastPath = '/home';
|
$rootScope.lastPath = '/home';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$rootScope.lastUser = $cookieStore.get('current_user').id;
|
||||||
|
$cookieStore.remove('token_expires');
|
||||||
|
$cookieStore.remove('current_user');
|
||||||
$cookieStore.remove('token');
|
$cookieStore.remove('token');
|
||||||
$cookieStore.put('userLoggedIn', false);
|
$cookieStore.put('userLoggedIn', false);
|
||||||
$cookieStore.put('sessionExpired', false);
|
$cookieStore.put('sessionExpired', false);
|
||||||
|
|||||||
Reference in New Issue
Block a user