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) <noreply@anthropic.com>
This commit is contained in:
parent
32c3dfc1b0
commit
be6aa2b1bc
1 changed files with 10 additions and 1 deletions
|
|
@ -13,8 +13,17 @@ const authorizationHandle: Handle = async ({ event, resolve }) => {
|
||||||
|
|
||||||
const session = await event.locals.auth();
|
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 === '/') {
|
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) {
|
if (session?.user) {
|
||||||
throw redirect(303, '/workspace');
|
throw redirect(303, '/workspace');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue