mirror of
https://github.com/ansible/awx.git
synced 2026-01-17 04:31:21 -03:30
Adds logic to redirect unauthenticated user if LOGIN_REDIRECT_OVERRIDE is set as long as the user is not navigating to /login or /#/login. Also redirects on logout if LOGIN_REDIRECT_OVERRIDE is set.
This commit is contained in:
parent
9c9496a683
commit
181421a2ee
@ -375,7 +375,13 @@ angular
|
||||
if (!/^\/(login|logout)/.test($location.path())) {
|
||||
$rootScope.preAuthUrl = $location.path();
|
||||
}
|
||||
$location.path('/login');
|
||||
if ($location.path() !== '/login') {
|
||||
if (global.$AnsibleConfig.login_redirect_override) {
|
||||
window.location.replace(global.$AnsibleConfig.login_redirect_override);
|
||||
} else {
|
||||
$location.path('/login');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
var lastUser = $cookies.getObject('current_user'),
|
||||
timestammp = Store('sessionTime');
|
||||
@ -383,7 +389,11 @@ angular
|
||||
var stime = timestammp[lastUser.id].time,
|
||||
now = new Date().getTime();
|
||||
if ((stime - now) <= 0) {
|
||||
$location.path('/login');
|
||||
if (global.$AnsibleConfig.login_redirect_override) {
|
||||
window.location.replace(global.$AnsibleConfig.login_redirect_override);
|
||||
} else {
|
||||
$location.path('/login');
|
||||
}
|
||||
}
|
||||
}
|
||||
// If browser refresh, set the user_is_superuser value
|
||||
|
||||
@ -11,7 +11,11 @@ export default {
|
||||
route: '/logout',
|
||||
controller: ['Authorization', '$state', function(Authorization, $state) {
|
||||
Authorization.logout().then( () =>{
|
||||
$state.go('signIn');
|
||||
if (global.$AnsibleConfig.login_redirect_override) {
|
||||
window.location.replace(global.$AnsibleConfig.login_redirect_override);
|
||||
} else {
|
||||
$state.go('signIn');
|
||||
}
|
||||
});
|
||||
|
||||
}],
|
||||
|
||||
@ -2,7 +2,6 @@ export default
|
||||
function LoadConfig($log, $rootScope, $http, Store) {
|
||||
return function() {
|
||||
|
||||
|
||||
var configSettings = {};
|
||||
|
||||
var configInit = function() {
|
||||
@ -10,12 +9,11 @@ export default
|
||||
if ($rootScope.loginConfig) {
|
||||
$rootScope.loginConfig.resolve('config loaded');
|
||||
}
|
||||
global.$AnsibleConfig = configSettings;
|
||||
Store('AnsibleConfig', global.$AnsibleConfig);
|
||||
$rootScope.$emit('ConfigReady');
|
||||
|
||||
// Load new hardcoded settings from above
|
||||
|
||||
global.$AnsibleConfig = configSettings;
|
||||
Store('AnsibleConfig', global.$AnsibleConfig);
|
||||
$rootScope.$emit('LoadConfig');
|
||||
};
|
||||
|
||||
@ -39,6 +37,10 @@ export default
|
||||
configSettings.custom_login_info = false;
|
||||
}
|
||||
|
||||
if (data.login_redirect_override) {
|
||||
configSettings.login_redirect_override = data.login_redirect_override;
|
||||
}
|
||||
|
||||
configInit();
|
||||
|
||||
}).catch(({error}) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user