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 ; }