diff --git a/release-notes/7.0.4/fix/4059.md b/release-notes/7.0.4/fix/4059.md deleted file mode 100644 index 202ca4d33c..0000000000 --- a/release-notes/7.0.4/fix/4059.md +++ /dev/null @@ -1 +0,0 @@ -Wrongfully hidden "Use Custom URLs Instead of Default URLs" checkbox on Authentication Source Administration page. diff --git a/release-notes/7.0.5/fix/4059.md b/release-notes/7.0.5/fix/4059.md new file mode 100644 index 0000000000..359e517506 --- /dev/null +++ b/release-notes/7.0.5/fix/4059.md @@ -0,0 +1 @@ +Authentication Source Administration page wrongfully handled the "Custom URLs Instead of Default URLs" checkbox (missing checkbox, irrelevant fields) [#4059](https://codeberg.org/forgejo/forgejo/pulls/4059) [#4194](https://codeberg.org/forgejo/forgejo/pulls/4194) \ No newline at end of file diff --git a/web_src/js/features/admin/common.js b/web_src/js/features/admin/common.js index c2f3cde821..1a5bd6e490 100644 --- a/web_src/js/features/admin/common.js +++ b/web_src/js/features/admin/common.js @@ -78,10 +78,9 @@ export function initAdminCommon() { 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 (customURLSettings.getAttribute('data-available')) { + const customURLRequired = (customURLSettings.getAttribute('data-required') === 'true'); + document.getElementById('oauth2_use_custom_url').checked = customURLRequired; + if (customURLRequired || customURLSettings.getAttribute('data-available') === 'true') { showElem('.oauth2_use_custom_url'); } } @@ -103,7 +102,7 @@ export function initAdminCommon() { if (applyDefaultValues) { document.getElementById(`oauth2_${custom}`).value = customInput.value; } - if (customInput.getAttribute('data-available')) { + if (customInput.getAttribute('data-available') === 'true') { for (const input of document.querySelectorAll(`.oauth2_${custom} input`)) { input.setAttribute('required', 'required'); }