From 773e12202968eb1000ee243342fcd22a1b45fb57 Mon Sep 17 00:00:00 2001 From: motatoes Date: Wed, 23 Oct 2024 13:24:50 +0100 Subject: [PATCH] hotfix emai lsending --- src/app/route.ts | 6 ------ src/middleware.ts | 7 +++++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/app/route.ts b/src/app/route.ts index 2594f57c..778f1a41 100644 --- a/src/app/route.ts +++ b/src/app/route.ts @@ -4,12 +4,6 @@ import { NextResponse } from 'next/server'; export const dynamic = 'force-dynamic'; export async function GET() { - if (process.env.NEXT_PUBLIC_SSO_DOMAIN !== undefined) { - return NextResponse.redirect( - new URL('/auth/sso-verify', process.env.NEXT_PUBLIC_SITE_URL), - ); - } - const supabase = createSupabaseUserRouteHandlerClient(); const { diff --git a/src/middleware.ts b/src/middleware.ts index 6c40dab3..2dee6f8d 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -78,8 +78,11 @@ export async function middleware(req: NextRequest) { { supabaseUrl: process.env.NEXT_PUBLIC_SUPABASE_URL }, ); - if (req.nextUrl.pathname === '/') { - return res; + if ( + process.env.NEXT_PUBLIC_SSO_DOMAIN !== undefined && + req.nextUrl.pathname === '/' + ) { + return NextResponse.redirect(toSiteURL('/auth/sso-verify')); } const sessionResponse = await supabase.auth.getSession();