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