mirror of
https://github.com/ansible/awx.git
synced 2026-05-18 06:47:41 -02:30
AC-712 fixed login spinnning tab disable issue
This commit is contained in:
@@ -270,12 +270,10 @@ angular.module('ansible', [
|
|||||||
}
|
}
|
||||||
|
|
||||||
// On each navigation request, check that the user is logged in
|
// On each navigation request, check that the user is logged in
|
||||||
var tst = /(login|logout)/;
|
if ( !/^\/(login|logout)/.test($location.path()) ) {
|
||||||
var path = $location.path();
|
|
||||||
if ( !tst.test($location.path()) ) {
|
|
||||||
// capture most recent URL, excluding login/logout
|
// capture most recent URL, excluding login/logout
|
||||||
$rootScope.lastPath = path;
|
$rootScope.lastPath = $location.path();
|
||||||
$cookieStore.put('lastPath', path);
|
$cookieStore.put('lastPath', $location.path());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Authorization.isUserLoggedIn() == false) {
|
if (Authorization.isUserLoggedIn() == false) {
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ var $AnsibleConfig =
|
|||||||
// > password_strength = green
|
// > password_strength = green
|
||||||
// It also controls password validation. Passwords are rejected if the score is not > password_strength.
|
// It also controls password validation. Passwords are rejected if the score is not > password_strength.
|
||||||
|
|
||||||
session_timeout: 1800 // Number of seconds before an inactive session is automatically timed out and forced to log in again.
|
session_timeout: 1800 // Number of seconds before an inactive session is automatically timed out and forced to log in again.
|
||||||
// Separate from time out value set in API.
|
// Separate from time out value set in API.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,17 +17,15 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth
|
|||||||
$('#login-username').focus();
|
$('#login-username').focus();
|
||||||
};
|
};
|
||||||
|
|
||||||
var sessionExpired = function() {
|
var sessionExpired = (Empty($rootScope.sessionExpired)) ? $cookieStore.get('sessionExpired') : $rootScope.sessionExpired;
|
||||||
return (Empty($rootScope.sessionExpired)) ? $cookieStore.get('sessionExpired') : $rootScope.sessionExpired;
|
|
||||||
}();
|
|
||||||
|
|
||||||
var lastPath = function() {
|
var lastPath = function() {
|
||||||
return (Empty($rootScope.lastPath)) ? $cookieStore.get('lastPath') : $rootScope.lastPath;
|
return (Empty($rootScope.lastPath)) ? $cookieStore.get('lastPath') : $rootScope.lastPath;
|
||||||
}();
|
}
|
||||||
|
|
||||||
if ($AnsibleConfig.debug_mode && console) {
|
if ($AnsibleConfig.debug_mode && console) {
|
||||||
console.log('User session expired: ' + sessionExpired);
|
console.log('User session expired: ' + sessionExpired);
|
||||||
console.log('Last URL: ' + lastPath);
|
console.log('Last URL: ' + lastPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hide any lingering modal dialogs
|
// Hide any lingering modal dialogs
|
||||||
@@ -59,7 +57,6 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth
|
|||||||
if ($location.path() == '/logout') {
|
if ($location.path() == '/logout') {
|
||||||
//if logout request, clear AuthToken and user session data
|
//if logout request, clear AuthToken and user session data
|
||||||
Authorization.logout();
|
Authorization.logout();
|
||||||
$location.url('/home');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$rootScope.userLoggedIn = false; //hide the logout link. if you got here, you're logged out.
|
$rootScope.userLoggedIn = false; //hide the logout link. if you got here, you're logged out.
|
||||||
@@ -88,7 +85,6 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth
|
|||||||
Wait('start');
|
Wait('start');
|
||||||
Authorization.retrieveToken(username, password)
|
Authorization.retrieveToken(username, password)
|
||||||
.success( function(data, status, headers, config) {
|
.success( function(data, status, headers, config) {
|
||||||
Wait('stop');
|
|
||||||
$('#login-modal').modal('hide');
|
$('#login-modal').modal('hide');
|
||||||
token = data.token;
|
token = data.token;
|
||||||
Authorization.setToken(data.token, data.expires);
|
Authorization.setToken(data.token, data.expires);
|
||||||
@@ -101,19 +97,21 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth
|
|||||||
Authorization.getLicense()
|
Authorization.getLicense()
|
||||||
.success(function(data, status, headers, config) {
|
.success(function(data, status, headers, config) {
|
||||||
Authorization.setLicense(data['license_info']);
|
Authorization.setLicense(data['license_info']);
|
||||||
if (lastPath) {
|
if (lastPath()) {
|
||||||
// Go back to most recent navigation path
|
// Go back to most recent navigation path
|
||||||
$location.path(lastPath);
|
$location.path(lastPath());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$location.url('/home?login=true');
|
$location.url('/home?login=true');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.error(function(data, status, headers, config) {
|
.error(function(data, status, headers, config) {
|
||||||
|
Wait('stop');
|
||||||
Alert('Error', 'Failed to access user information. GET returned status: ' + status, 'alert-danger', setLoginFocus);
|
Alert('Error', 'Failed to access user information. GET returned status: ' + status, 'alert-danger', setLoginFocus);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.error( function(data, status, headers, config) {
|
.error( function(data, status, headers, config) {
|
||||||
|
Wait('stop');
|
||||||
Alert('Error', 'Failed to access license information. GET returned status: ' + status, 'alert-danger', setLoginFocus);
|
Alert('Error', 'Failed to access license information. GET returned status: ' + status, 'alert-danger', setLoginFocus);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -56,13 +56,14 @@ angular.module('AuthService', ['ngCookies', 'Utilities'])
|
|||||||
$cookieStore.remove('lastPath');
|
$cookieStore.remove('lastPath');
|
||||||
$cookieStore.put('userLoggedIn', false);
|
$cookieStore.put('userLoggedIn', false);
|
||||||
$cookieStore.put('sessionExpired', false);
|
$cookieStore.put('sessionExpired', false);
|
||||||
|
$cookieStore.remove('lastPath', '/home');
|
||||||
$rootScope.current_user = {};
|
$rootScope.current_user = {};
|
||||||
$rootScope.license_tested = undefined;
|
$rootScope.license_tested = undefined;
|
||||||
$rootScope.userLoggedIn = false;
|
$rootScope.userLoggedIn = false;
|
||||||
$rootScope.sessionExpired = false;
|
$rootScope.sessionExpired = false;
|
||||||
$rootScope.token = null;
|
$rootScope.token = null;
|
||||||
$rootScope.token_expires = null;
|
$rootScope.token_expires = null;
|
||||||
$rootScope.lastPath = '/';
|
$rootScope.lastPath = '/home';
|
||||||
},
|
},
|
||||||
|
|
||||||
getLicense: function() {
|
getLicense: function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user