From 4aeda635ff9f49a6446d68e0b6e7f3b42c277eb2 Mon Sep 17 00:00:00 2001 From: mabashian Date: Tue, 1 Oct 2019 10:17:33 -0400 Subject: [PATCH] Checks to make sure that OAUTH2_PROVIDER key is returned by api in settings options before attempting to use it. This fixes a bug where setting ACCESS_TOKEN_EXPIRE_SECONDS and AUTHORIZATION_CODE_EXPIRE_SECONDS manually in a file was causing the settings page to render improperly. --- .../src/configuration/settings.service.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/awx/ui/client/src/configuration/settings.service.js b/awx/ui/client/src/configuration/settings.service.js index e873082258..e72a43e7b4 100644 --- a/awx/ui/client/src/configuration/settings.service.js +++ b/awx/ui/client/src/configuration/settings.service.js @@ -34,14 +34,16 @@ export default ['GetBasePath', '$q', 'Rest', 'i18n', } delete optsFromAPI[key].child; }; - unnestOauth2ProviderKey('ACCESS_TOKEN_EXPIRE_SECONDS', - i18n._('The duration (in seconds) access tokens remain valid since their creation.'), - i18n._('Access Token Expiration'), - 'OAUTH2_PROVIDER'); - unnestOauth2ProviderKey('AUTHORIZATION_CODE_EXPIRE_SECONDS', - i18n._('The duration (in seconds) authorization codes remain valid since their creation.'), - i18n._('Authorization Code Expiration'), - 'OAUTH2_PROVIDER'); + if (optsFromAPI.OAUTH2_PROVIDER) { + unnestOauth2ProviderKey('ACCESS_TOKEN_EXPIRE_SECONDS', + i18n._('The duration (in seconds) access tokens remain valid since their creation.'), + i18n._('Access Token Expiration'), + 'OAUTH2_PROVIDER'); + unnestOauth2ProviderKey('AUTHORIZATION_CODE_EXPIRE_SECONDS', + i18n._('The duration (in seconds) authorization codes remain valid since their creation.'), + i18n._('Authorization Code Expiration'), + 'OAUTH2_PROVIDER'); + } return optsFromAPI; }; var getActions = appendOauth2ProviderKeys(data.actions.GET);