mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 10:30:03 -03:30
Merge pull request #162 from jlmitch5/fix_authentication_routing
fixed authentication routing on the ui
This commit is contained in:
commit
561b4c3a02
@ -180,7 +180,6 @@ var tower = angular.module('Tower', [
|
||||
.constant('$timezones.definitions.location', urlPrefix + 'lib/angular-tz-extensions/tz/data')
|
||||
.config(['$routeProvider',
|
||||
function ($routeProvider) {
|
||||
|
||||
$routeProvider.
|
||||
|
||||
when('/jobs', {
|
||||
@ -644,6 +643,7 @@ var tower = angular.module('Tower', [
|
||||
if (!/^\/(login|logout)/.test($location.path())) {
|
||||
// capture most recent URL, excluding login/logout
|
||||
$rootScope.lastPath = $location.path();
|
||||
$rootScope.enteredPath = $location.path();
|
||||
$cookieStore.put('lastPath', $location.path());
|
||||
}
|
||||
|
||||
|
||||
@ -105,6 +105,16 @@ export function Authenticate($log, $cookieStore, $compile, $window, $rootScope,
|
||||
if ($location.path() === '/logout') {
|
||||
//if logout request, clear AuthToken and user session data
|
||||
Authorization.logout();
|
||||
} else if ($location.path() === '/login') {
|
||||
if ($rootScope.enteredPath) {
|
||||
$rootScope.lastPath = $rootScope.enteredPath;
|
||||
} else if (!$rootScope.lastPath) {
|
||||
// your last path was home
|
||||
$cookieStore.remove('lastPath');
|
||||
$rootScope.lastPath = '/home';
|
||||
}
|
||||
} else {
|
||||
$rootScope.enteredPath = $location.path();
|
||||
}
|
||||
|
||||
e = angular.element(document.getElementById('login-modal-content'));
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
export default
|
||||
angular.module('LoadConfigHelper', ['Utilities'])
|
||||
|
||||
.factory('LoadConfig', ['$log', '$rootScope', '$http', 'ProcessErrors', 'Store', function($log, $rootScope, $http, ProcessErrors, Store) {
|
||||
.factory('LoadConfig', ['$log', '$rootScope', '$http', '$location', 'ProcessErrors', 'Store', function($log, $rootScope, $http, $location, ProcessErrors, Store) {
|
||||
return function() {
|
||||
|
||||
if ($rootScope.removeLoadConfig) {
|
||||
@ -42,6 +42,7 @@ angular.module('LoadConfigHelper', ['Utilities'])
|
||||
});
|
||||
});
|
||||
|
||||
$rootScope.enteredPath = $location.path();
|
||||
// Load js/local_config.js
|
||||
$http({ method:'GET', url: $basePath + 'js/local_config.js' })
|
||||
.success(function(data) {
|
||||
|
||||
@ -70,7 +70,12 @@ angular.module('AuthService', ['ngCookies', Utilities.name])
|
||||
$cookieStore.put( 'lastPath', '/portal');
|
||||
$rootScope.lastPath = '/portal';
|
||||
}
|
||||
else if ($cookieStore.get('lastPath') !== '/home' || $cookieStore.get('lastPath') !== '/'){
|
||||
// do nothing
|
||||
$rootScope.lastPath = $cookieStore.get('lastPath');
|
||||
}
|
||||
else {
|
||||
// your last path was home
|
||||
$cookieStore.remove('lastPath');
|
||||
$rootScope.lastPath = '/home';
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user