diff --git a/web_src/js/features/admin/common.js b/web_src/js/features/admin/common.js index b35502d52f..9b7b81db04 100644 --- a/web_src/js/features/admin/common.js +++ b/web_src/js/features/admin/common.js @@ -75,13 +75,16 @@ export function initAdminCommon() { } showElem('.open_id_connect_auto_discovery_url'); break; - default: - if (document.getElementById(`#${provider}_customURLSettings`)?.getAttribute('data-required')) { + default: { + const customURLSettings = document.getElementById(`${provider}_customURLSettings`); + if (!customURLSettings) break; + if (customURLSettings.getAttribute('data-required')) { document.getElementById('oauth2_use_custom_url')?.setAttribute('checked', 'checked'); } - if (document.getElementById(`#${provider}_customURLSettings`)?.getAttribute('data-available')) { + if (customURLSettings.getAttribute('data-available')) { showElem('.oauth2_use_custom_url'); } + } } onOAuth2UseCustomURLChange(applyDefaultValues); }