fix: password reset redirect naar update-password pagina
This commit is contained in:
@@ -23,7 +23,8 @@ export async function GET(request: NextRequest) {
|
|||||||
|
|
||||||
if (!error && data.user) {
|
if (!error && data.user) {
|
||||||
// Password recovery flow - always go to update-password
|
// 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))
|
return NextResponse.redirect(new URL('/update-password', request.url))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ export async function signUpWithPassword(email: string, password: string) {
|
|||||||
export async function resetPasswordForEmail(email: string) {
|
export async function resetPasswordForEmail(email: string) {
|
||||||
const supabase = createClient()
|
const supabase = createClient()
|
||||||
const { error } = await supabase.auth.resetPasswordForEmail(email, {
|
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
|
if (error) throw error
|
||||||
|
|||||||
Reference in New Issue
Block a user