fix: password reset redirect naar update-password pagina

This commit is contained in:
colinislit
2025-11-19 12:09:40 +01:00
parent 1c305c7d1e
commit d01eb0ba69
2 changed files with 3 additions and 2 deletions

View File

@@ -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))
}

View File

@@ -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