diff --git a/web_src/js/features/admin/common.js b/web_src/js/features/admin/common.js index 9b7b81db04..c2f3cde821 100644 --- a/web_src/js/features/admin/common.js +++ b/web_src/js/features/admin/common.js @@ -98,11 +98,12 @@ export function initAdminCommon() { if (document.getElementById('oauth2_use_custom_url')?.checked) { for (const custom of ['token_url', 'auth_url', 'profile_url', 'email_url', 'tenant']) { - if (applyDefaultValues) { - document.getElementById(`oauth2_${custom}`).value = document.getElementById(`${provider}_${custom}`).value; - } const customInput = document.getElementById(`${provider}_${custom}`); - if (customInput && customInput.getAttribute('data-available')) { + if (!customInput) continue; + if (applyDefaultValues) { + document.getElementById(`oauth2_${custom}`).value = customInput.value; + } + if (customInput.getAttribute('data-available')) { for (const input of document.querySelectorAll(`.oauth2_${custom} input`)) { input.setAttribute('required', 'required'); }