From d01eb0ba69dc8a36be88615975418131bdb1f414 Mon Sep 17 00:00:00 2001 From: colinislit Date: Wed, 19 Nov 2025 12:09:40 +0100 Subject: [PATCH] fix: password reset redirect naar update-password pagina --- app/auth/callback/route.ts | 3 ++- lib/auth/client.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/auth/callback/route.ts b/app/auth/callback/route.ts index 4a0af49..80a5bb7 100644 --- a/app/auth/callback/route.ts +++ b/app/auth/callback/route.ts @@ -23,7 +23,8 @@ export async function GET(request: NextRequest) { if (!error && data.user) { // Password recovery flow - always go to update-password - if (type === 'recovery') { + // Check both query param and if next contains update-password (fallback) + if (type === 'recovery' || next.includes('/update-password')) { return NextResponse.redirect(new URL('/update-password', request.url)) } diff --git a/lib/auth/client.ts b/lib/auth/client.ts index 019d128..292fb69 100644 --- a/lib/auth/client.ts +++ b/lib/auth/client.ts @@ -129,7 +129,7 @@ export async function signUpWithPassword(email: string, password: string) { export async function resetPasswordForEmail(email: string) { const supabase = createClient() const { error } = await supabase.auth.resetPasswordForEmail(email, { - redirectTo: `${window.location.origin}/auth/callback?next=/update-password` + redirectTo: `${window.location.origin}/auth/callback?type=recovery&next=/update-password` }) if (error) throw error