page.tsx / client.tsx

This commit is contained in:
colinislit
2025-11-19 13:45:44 +01:00
parent 55c30b17f5
commit 4f5d99717b
3 changed files with 45 additions and 2 deletions

View File

@@ -128,9 +128,10 @@ export async function signUpWithPassword(email: string, password: string) {
*/
export async function resetPasswordForEmail(email: string) {
const supabase = createClient()
// Redirect to callback route which will handle code exchange and redirect to /update-password
// Redirect to callback route - Supabase will automatically add type=recovery parameter
// The callback route will detect type=recovery and redirect to /update-password
const { error } = await supabase.auth.resetPasswordForEmail(email, {
redirectTo: `${window.location.origin}/auth/callback?next=/update-password`
redirectTo: `${window.location.origin}/auth/callback`
})
if (error) throw error