Making login page open SSO authorization on same page, rather than leaving a dead tab.
This commit is contained in:
parent
8673ed1dae
commit
ea70b6232f
|
@ -3,6 +3,7 @@
|
||||||
import GoogleLogo from "assets/google-logo.png"
|
import GoogleLogo from "assets/google-logo.png"
|
||||||
import { auth, organisation } from "stores/portal"
|
import { auth, organisation } from "stores/portal"
|
||||||
|
|
||||||
|
export let samePage
|
||||||
let show
|
let show
|
||||||
|
|
||||||
$: tenantId = $auth.tenantId
|
$: tenantId = $auth.tenantId
|
||||||
|
@ -12,8 +13,14 @@
|
||||||
{#if show}
|
{#if show}
|
||||||
<FancyButton
|
<FancyButton
|
||||||
icon={GoogleLogo}
|
icon={GoogleLogo}
|
||||||
on:click={() =>
|
on:click={() => {
|
||||||
window.open(`/api/global/auth/${tenantId}/google`, "_blank")}
|
const url = `/api/global/auth/${tenantId}/google`
|
||||||
|
if (samePage) {
|
||||||
|
window.location = url
|
||||||
|
} else {
|
||||||
|
window.open(url, "_blank")
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Log in with Google
|
Log in with Google
|
||||||
</FancyButton>
|
</FancyButton>
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
import { oidc, organisation, auth } from "stores/portal"
|
import { oidc, organisation, auth } from "stores/portal"
|
||||||
import { onMount } from "svelte"
|
import { onMount } from "svelte"
|
||||||
|
|
||||||
|
export let samePage
|
||||||
|
|
||||||
$: show = $organisation.oidc
|
$: show = $organisation.oidc
|
||||||
|
|
||||||
let preDefinedIcons = {
|
let preDefinedIcons = {
|
||||||
|
@ -35,11 +37,14 @@
|
||||||
{#if show}
|
{#if show}
|
||||||
<FancyButton
|
<FancyButton
|
||||||
icon={src}
|
icon={src}
|
||||||
on:click={() =>
|
on:click={() => {
|
||||||
window.open(
|
const url = `/api/global/auth/${$auth.tenantId}/oidc/configs/${$oidc.uuid}`
|
||||||
`/api/global/auth/${$auth.tenantId}/oidc/configs/${$oidc.uuid}`,
|
if (samePage) {
|
||||||
"_blank"
|
window.location = url
|
||||||
)}
|
} else {
|
||||||
|
window.open(url, "_blank")
|
||||||
|
}
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
{`Log in with ${$oidc.name || "OIDC"}`}
|
{`Log in with ${$oidc.name || "OIDC"}`}
|
||||||
</FancyButton>
|
</FancyButton>
|
||||||
|
|
|
@ -78,8 +78,8 @@
|
||||||
<Layout gap="S" noPadding>
|
<Layout gap="S" noPadding>
|
||||||
{#if loaded && ($organisation.google || $organisation.oidc)}
|
{#if loaded && ($organisation.google || $organisation.oidc)}
|
||||||
<FancyForm>
|
<FancyForm>
|
||||||
<OIDCButton oidcIcon={$oidc.logo} oidcName={$oidc.name} />
|
<OIDCButton oidcIcon={$oidc.logo} oidcName={$oidc.name} samePage />
|
||||||
<GoogleButton />
|
<GoogleButton samePage />
|
||||||
</FancyForm>
|
</FancyForm>
|
||||||
{/if}
|
{/if}
|
||||||
{#if !$organisation.isSSOEnforced}
|
{#if !$organisation.isSSOEnforced}
|
||||||
|
|
Loading…
Reference in New Issue