improved Login from response

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2025-08-30 12:54:26 +02:00
parent 7b5ea62bfd
commit 0b59a945ab

View File

@@ -36,7 +36,9 @@
}
async function redirectTo(service){
async function redirectTo(e,service){
const btn = e.target;
btn.disabled = true;
const url = api(`user/oidc/redirect/${service}`);
const resp = await fetch(url,{credentials:'include'});
if (resp.ok){
@@ -46,6 +48,9 @@
delete json.authorization_endpoint;
location.href = endpoint + '?' + new URLSearchParams(json);
}
} else {
error = resp.text();
btn.disabled = false;
}
}
@@ -100,6 +105,6 @@
<fieldset>
<legend>{t('oidc_Login')}</legend>
{#each services as service,i}
<button onclick={() => redirectTo(service)}>{service}</button>
<button onclick={e => redirectTo(e,service)}>{service}</button>
{/each}
</fieldset>