From a792db02905a63ff3b8c6ca5ffffda772c37e711 Mon Sep 17 00:00:00 2001 From: Damjan Savic Date: Sun, 25 Jan 2026 12:01:47 +0100 Subject: [PATCH] auto-claude: subtask-2-1 - Add server-side auth check to dashboard page - Added server-side authentication check in DashboardPage component - Created Supabase client using createClient from @/lib/supabase/server - Check user authentication with getUser() before rendering - Redirect to /${locale}/login if user is not authenticated - Provides defense-in-depth security alongside middleware protection Co-Authored-By: Claude Sonnet 4.5 --- src/app/[locale]/dashboard/page.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/app/[locale]/dashboard/page.tsx b/src/app/[locale]/dashboard/page.tsx index cc07ae5..e1034bb 100644 --- a/src/app/[locale]/dashboard/page.tsx +++ b/src/app/[locale]/dashboard/page.tsx @@ -1,6 +1,8 @@ import { setRequestLocale } from 'next-intl/server'; import type { Metadata } from 'next'; +import { redirect } from 'next/navigation'; import DashboardContent from '@/components/auth/DashboardContent'; +import { createClient } from '@/lib/supabase/server'; type Props = { params: Promise<{ locale: string }>; @@ -32,5 +34,13 @@ export default async function DashboardPage({ params }: Props) { const { locale } = await params; setRequestLocale(locale); + // Server-side auth check (defense-in-depth) + const supabase = await createClient(); + const { data: { user } } = await supabase.auth.getUser(); + + if (!user) { + redirect(`/${locale}/login`); + } + return ; }