mirror of
https://github.com/ansible/awx.git
synced 2026-01-19 21:51:26 -03:30
AC-712 fixed login spinnning tab disable issue
This commit is contained in:
parent
7269c7bd06
commit
9fe9556b50
@ -270,12 +270,10 @@ angular.module('ansible', [
|
||||
}
|
||||
|
||||
// On each navigation request, check that the user is logged in
|
||||
var tst = /(login|logout)/;
|
||||
var path = $location.path();
|
||||
if ( !tst.test($location.path()) ) {
|
||||
if ( !/^\/(login|logout)/.test($location.path()) ) {
|
||||
// capture most recent URL, excluding login/logout
|
||||
$rootScope.lastPath = path;
|
||||
$cookieStore.put('lastPath', path);
|
||||
$rootScope.lastPath = $location.path();
|
||||
$cookieStore.put('lastPath', $location.path());
|
||||
}
|
||||
|
||||
if (Authorization.isUserLoggedIn() == false) {
|
||||
|
||||
@ -21,6 +21,6 @@ var $AnsibleConfig =
|
||||
// > password_strength = green
|
||||
// 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.
|
||||
}
|
||||
|
||||
@ -17,17 +17,15 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth
|
||||
$('#login-username').focus();
|
||||
};
|
||||
|
||||
var sessionExpired = function() {
|
||||
return (Empty($rootScope.sessionExpired)) ? $cookieStore.get('sessionExpired') : $rootScope.sessionExpired;
|
||||
}();
|
||||
var sessionExpired = (Empty($rootScope.sessionExpired)) ? $cookieStore.get('sessionExpired') : $rootScope.sessionExpired;
|
||||
|
||||
var lastPath = function() {
|
||||
return (Empty($rootScope.lastPath)) ? $cookieStore.get('lastPath') : $rootScope.lastPath;
|
||||
}();
|
||||
}
|
||||
|
||||
if ($AnsibleConfig.debug_mode && console) {
|
||||
console.log('User session expired: ' + sessionExpired);
|
||||
console.log('Last URL: ' + lastPath);
|
||||
console.log('Last URL: ' + lastPath());
|
||||
}
|
||||
|
||||
// Hide any lingering modal dialogs
|
||||
@ -59,7 +57,6 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth
|
||||
if ($location.path() == '/logout') {
|
||||
//if logout request, clear AuthToken and user session data
|
||||
Authorization.logout();
|
||||
$location.url('/home');
|
||||
}
|
||||
|
||||
$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');
|
||||
Authorization.retrieveToken(username, password)
|
||||
.success( function(data, status, headers, config) {
|
||||
Wait('stop');
|
||||
$('#login-modal').modal('hide');
|
||||
token = data.token;
|
||||
Authorization.setToken(data.token, data.expires);
|
||||
@ -101,19 +97,21 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth
|
||||
Authorization.getLicense()
|
||||
.success(function(data, status, headers, config) {
|
||||
Authorization.setLicense(data['license_info']);
|
||||
if (lastPath) {
|
||||
if (lastPath()) {
|
||||
// Go back to most recent navigation path
|
||||
$location.path(lastPath);
|
||||
$location.path(lastPath());
|
||||
}
|
||||
else {
|
||||
$location.url('/home?login=true');
|
||||
}
|
||||
})
|
||||
.error(function(data, status, headers, config) {
|
||||
Wait('stop');
|
||||
Alert('Error', 'Failed to access user information. GET returned status: ' + status, 'alert-danger', setLoginFocus);
|
||||
});
|
||||
})
|
||||
.error( function(data, status, headers, config) {
|
||||
Wait('stop');
|
||||
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.put('userLoggedIn', false);
|
||||
$cookieStore.put('sessionExpired', false);
|
||||
$cookieStore.remove('lastPath', '/home');
|
||||
$rootScope.current_user = {};
|
||||
$rootScope.license_tested = undefined;
|
||||
$rootScope.userLoggedIn = false;
|
||||
$rootScope.sessionExpired = false;
|
||||
$rootScope.token = null;
|
||||
$rootScope.token_expires = null;
|
||||
$rootScope.lastPath = '/';
|
||||
$rootScope.lastPath = '/home';
|
||||
},
|
||||
|
||||
getLicense: function() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user