1
0
Fork 0
mirror of synced 2024-10-03 19:43:32 +13:00

Making login page open SSO authorization on same page, rather than leaving a dead tab.

This commit is contained in:
mike12345567 2023-03-31 14:52:18 +01:00
parent 8673ed1dae
commit ea70b6232f
3 changed files with 21 additions and 9 deletions

View file

@ -3,6 +3,7 @@
import GoogleLogo from "assets/google-logo.png"
import { auth, organisation } from "stores/portal"
export let samePage
let show
$: tenantId = $auth.tenantId
@ -12,8 +13,14 @@
{#if show}
<FancyButton
icon={GoogleLogo}
on:click={() =>
window.open(`/api/global/auth/${tenantId}/google`, "_blank")}
on:click={() => {
const url = `/api/global/auth/${tenantId}/google`
if (samePage) {
window.location = url
} else {
window.open(url, "_blank")
}
}}
>
Log in with Google
</FancyButton>

View file

@ -9,6 +9,8 @@
import { oidc, organisation, auth } from "stores/portal"
import { onMount } from "svelte"
export let samePage
$: show = $organisation.oidc
let preDefinedIcons = {
@ -35,11 +37,14 @@
{#if show}
<FancyButton
icon={src}
on:click={() =>
window.open(
`/api/global/auth/${$auth.tenantId}/oidc/configs/${$oidc.uuid}`,
"_blank"
)}
on:click={() => {
const url = `/api/global/auth/${$auth.tenantId}/oidc/configs/${$oidc.uuid}`
if (samePage) {
window.location = url
} else {
window.open(url, "_blank")
}
}}
>
{`Log in with ${$oidc.name || "OIDC"}`}
</FancyButton>

View file

@ -78,8 +78,8 @@
<Layout gap="S" noPadding>
{#if loaded && ($organisation.google || $organisation.oidc)}
<FancyForm>
<OIDCButton oidcIcon={$oidc.logo} oidcName={$oidc.name} />
<GoogleButton />
<OIDCButton oidcIcon={$oidc.logo} oidcName={$oidc.name} samePage />
<GoogleButton samePage />
</FancyForm>
{/if}
{#if !$organisation.isSSOEnforced}