diff --git a/packages/builder/src/components/deploy/DeployModal.svelte b/packages/builder/src/components/deploy/DeployModal.svelte index 3dcf0c27b1..33fe8d5321 100644 --- a/packages/builder/src/components/deploy/DeployModal.svelte +++ b/packages/builder/src/components/deploy/DeployModal.svelte @@ -1,21 +1,10 @@ diff --git a/packages/builder/src/pages/builder/_layout.svelte b/packages/builder/src/pages/builder/_layout.svelte index 338322b785..6cb78aa9da 100644 --- a/packages/builder/src/pages/builder/_layout.svelte +++ b/packages/builder/src/pages/builder/_layout.svelte @@ -4,9 +4,6 @@ import { onMount } from "svelte" let loaded = false - // don't react to these - let cloud = $admin.cloud - let shouldRedirect = !cloud || $admin.disableAccountPortal $: multiTenancyEnabled = $admin.multiTenancy $: hasAdminUser = $admin?.checklist?.adminUser?.checked @@ -14,6 +11,8 @@ $: cloud = $admin.cloud $: user = $auth.user + $: useAccountPortal = cloud && !$admin.disableAccountPortal + const validateTenantId = async () => { // set the tenant from the url in the cloud const tenantId = window.location.host.split(".")[0] @@ -41,12 +40,11 @@ }) $: { - // We should never see the org or admin user creation screens in the cloud const apiReady = $admin.loaded && $auth.loaded // if tenant is not set go to it if ( loaded && - shouldRedirect && + !useAccountPortal && apiReady && multiTenancyEnabled && !tenantSet @@ -54,7 +52,7 @@ $redirect("./auth/org") } // Force creation of an admin user if one doesn't exist - else if (loaded && shouldRedirect && apiReady && !hasAdminUser) { + else if (loaded && !useAccountPortal && apiReady && !hasAdminUser) { $redirect("./admin") } // Redirect to log in at any time if the user isn't authenticated diff --git a/packages/builder/src/pages/builder/admin/_layout.svelte b/packages/builder/src/pages/builder/admin/_layout.svelte index 602b6a6de3..f03a7b8285 100644 --- a/packages/builder/src/pages/builder/admin/_layout.svelte +++ b/packages/builder/src/pages/builder/admin/_layout.svelte @@ -5,8 +5,11 @@ let loaded = false + $: cloud = $admin.cloud + $: useAccountPortal = cloud && !$admin.disableAccountPortal + onMount(() => { - if ($admin?.checklist?.adminUser.checked) { + if ($admin?.checklist?.adminUser.checked || useAccountPortal) { $redirect("../") } else { loaded = true diff --git a/packages/builder/src/pages/builder/auth/org.svelte b/packages/builder/src/pages/builder/auth/org.svelte index 1e6b58dbe2..5a484b6c93 100644 --- a/packages/builder/src/pages/builder/auth/org.svelte +++ b/packages/builder/src/pages/builder/auth/org.svelte @@ -9,7 +9,8 @@ let tenantId = get(auth).tenantSet ? get(auth).tenantId : "" $: multiTenancyEnabled = $admin.multiTenancy $: cloud = $admin.cloud - $: disableAccountPortal = $admin.disableAccountPortal + + $: useAccountPortal = cloud && !$admin.disableAccountPortal async function setOrg() { if (tenantId == null || tenantId === "") { @@ -27,7 +28,7 @@ onMount(async () => { await auth.checkQueryString() - if (!multiTenancyEnabled || (cloud && !disableAccountPortal)) { + if (!multiTenancyEnabled || useAccountPortal) { $goto("../") } else { admin.unload()