Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-25 03:06:10 +01:00

Merge pull request '[v7.0/forgejo] [BUG] admin authentication source JS errors' (#4159) from bp-v7.0/forgejo-82ae746 into v7.0/forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4159
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
Earl Warren 2024-06-17 10:39:29 +00:00
commit 2d42dbc495
2 changed files with 12 additions and 7 deletions

View file

@ -0,0 +1 @@
Wrongfully hidden "Use Custom URLs Instead of Default URLs" checkbox on Authentication Source Administration page.

View file

@ -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);
}
@ -95,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');
}