From be6aa2b1bc26e76fc441289a662157a40eeeaaab Mon Sep 17 00:00:00 2001 From: vegard Date: Thu, 19 Mar 2026 03:47:02 +0000 Subject: [PATCH] workspace.synops.no: redirect til login/workspace, aldri vis landingsside Host-basert logikk i hooks: workspace.* sender uautentiserte til login og autentiserte til /workspace. synops.no viser landingsside. Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/src/hooks.server.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/hooks.server.ts b/frontend/src/hooks.server.ts index 7c6b94c..c7fdbdd 100644 --- a/frontend/src/hooks.server.ts +++ b/frontend/src/hooks.server.ts @@ -13,8 +13,17 @@ const authorizationHandle: Handle = async ({ event, resolve }) => { const session = await event.locals.auth(); - // Landing page: show for unauthenticated, redirect to workspace for authenticated + // Landing page: only on synops.no (not workspace.synops.no) if (path === '/') { + const host = event.url.hostname; + if (host.startsWith('workspace.')) { + // workspace.synops.no: uautentisert → login, autentisert → workspace + if (!session?.user) { + throw redirect(303, '/auth/signin'); + } + throw redirect(303, '/workspace'); + } + // synops.no: vis landingsside for alle if (session?.user) { throw redirect(303, '/workspace'); }