1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Changes redirect logic slightly to lean on a global var to store the config response rather than a constant on the awApp module. This should allow us to avoid test changes.

This commit is contained in:
mabashian 2019-12-11 16:31:39 -05:00 committed by Graham Mainwaring
parent c16ad89ff9
commit 475e2605d4
3 changed files with 12 additions and 10 deletions

View File

@ -3,6 +3,8 @@ global.$AnsibleConfig = null;
// Provided via Webpack DefinePlugin in webpack.config.js
global.$ENV = {};
global.$ConfigResponse = {};
var urlPrefix;
if ($basePath) {

View File

@ -55,7 +55,7 @@ function fetchConfig (callback) {
const request = $.ajax('/api/');
request.done(res => {
angular.module('awApp').constant('ConfigSettings', res);
global.$ConfigResponse = res;
if (res.login_redirect_override) {
if (!document.cookie.split(';').filter((item) => item.includes('userLoggedIn=true')).length && !window.location.href.includes('/#/login')) {
window.location.replace(res.login_redirect_override);

View File

@ -1,25 +1,25 @@
export default
function LoadConfig($rootScope, Store, ConfigSettings) {
function LoadConfig($rootScope, Store) {
return function() {
var configSettings = {};
if(ConfigSettings.custom_logo) {
if(global.$ConfigResponse.custom_logo) {
configSettings.custom_logo = true;
$rootScope.custom_logo = ConfigSettings.custom_logo;
$rootScope.custom_logo = global.$ConfigResponse.custom_logo;
} else {
configSettings.custom_logo = false;
}
if(ConfigSettings.custom_login_info) {
configSettings.custom_login_info = ConfigSettings.custom_login_info;
$rootScope.custom_login_info = ConfigSettings.custom_login_info;
if(global.$ConfigResponse.custom_login_info) {
configSettings.custom_login_info = global.$ConfigResponse.custom_login_info;
$rootScope.custom_login_info = global.$ConfigResponse.custom_login_info;
} else {
configSettings.custom_login_info = false;
}
if (ConfigSettings.login_redirect_override) {
configSettings.login_redirect_override = ConfigSettings.login_redirect_override;
if (global.$ConfigResponse.login_redirect_override) {
configSettings.login_redirect_override = global.$ConfigResponse.login_redirect_override;
}
// Auto-resolving what used to be found when attempting to load local_setting.json
@ -37,4 +37,4 @@ export default
}
LoadConfig.$inject =
[ '$rootScope', 'Store', 'ConfigSettings' ];
[ '$rootScope', 'Store' ];