güncelleme

This commit is contained in:
2026-01-29 16:49:51 +03:00
parent 10bfa3089e
commit 54113726f4
38 changed files with 1469 additions and 642 deletions

View File

@@ -38,11 +38,19 @@ export async function middleware(request: NextRequest) {
} = await supabase.auth.getUser();
// Protected routes
if (!user && request.nextUrl.pathname.startsWith("/dashboard")) {
return NextResponse.redirect(new URL("/login", request.url));
if (request.nextUrl.pathname.startsWith("/dashboard")) {
if (!user) {
return NextResponse.redirect(new URL("/login", request.url));
}
// 2FA Check
const isVerified = request.cookies.get('parakasa_2fa_verified')?.value === 'true'
if (!isVerified) {
return NextResponse.redirect(new URL("/verify-2fa", request.url));
}
}
// Redirect to dashboard if logged in and trying to access auth pages
// Redirect to dashboard (or verify) if logged in
if (user && (request.nextUrl.pathname.startsWith("/login") || request.nextUrl.pathname.startsWith("/signup"))) {
return NextResponse.redirect(new URL("/dashboard", request.url));
}