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 <noreply@anthropic.com>
This commit is contained in:
2026-01-25 12:01:47 +01:00
co-authored by Claude Sonnet 4.5
parent 2337b15e53
commit a792db0290
+10
View File
@@ -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 <DashboardContent />;
}