Move account portal redirect to top of auth level

This commit is contained in:
Rory Powell 2021-09-14 15:57:34 +01:00
parent 011193a3dc
commit 33090a2521
3 changed files with 7 additions and 8 deletions

View File

@ -1,5 +1,5 @@
<script> <script>
import { auth } from "stores/portal" import { auth, admin } from "stores/portal"
import { onMount } from "svelte" import { onMount } from "svelte"
import { redirect } from "@roxi/routify" import { redirect } from "@roxi/routify"
@ -10,6 +10,11 @@
if ($auth.user && !$auth.user.forceResetPassword) { if ($auth.user && !$auth.user.forceResetPassword) {
$redirect("../") $redirect("../")
} }
// redirect to account portal for authentication in the cloud
if ($admin.cloud && $admin.accountPortalUrl) {
window.location.href = $admin.accountPortalUrl
}
}) })
</script> </script>

View File

@ -51,12 +51,6 @@
onMount(async () => { onMount(async () => {
await organisation.init() await organisation.init()
// redirect to account portal for login in the cloud
if ($admin.cloud && $admin.accountPortalUrl) {
window.location.href = $admin.accountPortalUrl
}
loaded = true loaded = true
}) })
</script> </script>

View File

@ -60,7 +60,7 @@
} }
// add link to account portal if the user has access // add link to account portal if the user has access
if ($auth.user.account) { if ($auth?.user?.account) {
menu = menu.concat([ menu = menu.concat([
{ {
title: "Account", title: "Account",