diff --git a/packages/builder/src/pages/builder/_layout.svelte b/packages/builder/src/pages/builder/_layout.svelte
index 11d41af0ae..7f0f8a1ae0 100644
--- a/packages/builder/src/pages/builder/_layout.svelte
+++ b/packages/builder/src/pages/builder/_layout.svelte
@@ -28,7 +28,8 @@
!$isActive("./auth") &&
!$isActive("./invite")
) {
- $redirect("./auth/login")
+ const returnUrl = encodeURIComponent(window.location.pathname)
+ $redirect("./auth/login?", { returnUrl })
}
}
diff --git a/packages/builder/src/pages/builder/auth/_layout.svelte b/packages/builder/src/pages/builder/auth/_layout.svelte
index e69de29bb2..ac224a41db 100644
--- a/packages/builder/src/pages/builder/auth/_layout.svelte
+++ b/packages/builder/src/pages/builder/auth/_layout.svelte
@@ -0,0 +1,18 @@
+
+
+{#if !$auth.user}
+
+{/if}
diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte
index b6bc1b07bf..2137ccc199 100644
--- a/packages/builder/src/pages/builder/portal/_layout.svelte
+++ b/packages/builder/src/pages/builder/portal/_layout.svelte
@@ -37,11 +37,13 @@
onMount(async () => {
// Prevent non-builders from accessing the portal
- if (!$auth.user?.builder?.global) {
- $redirect("../")
- } else {
- await organisation.init()
- loaded = true
+ if ($auth.user) {
+ if (!$auth.user?.builder?.global) {
+ $redirect("../")
+ } else {
+ await organisation.init()
+ loaded = true
+ }
}
})