fix(frontend): forward all Supabase error params and toast on expired links

Forward error_code and error_description from Supabase through the
callback to the reset-password page. Also show a toast with the
Supabase error detail when a link is expired, so the exact error
is always visible for debugging.
This commit is contained in:
Otto (AGPT)
2026-03-12 13:14:51 +00:00
parent e74fab3a5a
commit 7e11dc1497
2 changed files with 15 additions and 3 deletions

View File

@@ -42,6 +42,14 @@ function ResetPasswordContent() {
if (isExpiredOrUsed) {
setShowExpiredMessage(true);
// Also show a toast with the Supabase error detail for debugging
if (errorDescription) {
toast({
title: "Link Expired",
description: errorDescription,
variant: "destructive",
});
}
} else {
// Show toast for other errors
const errorMessage =

View File

@@ -29,9 +29,13 @@ export async function GET(request: NextRequest) {
errorDescription || error || "Missing verification code",
);
return NextResponse.redirect(
`${origin}/reset-password?error=${errorParam}`,
);
const redirectUrl = new URL(`${origin}/reset-password`);
redirectUrl.searchParams.set("error", errorParam);
if (errorCode) redirectUrl.searchParams.set("error_code", errorCode);
if (errorDescription)
redirectUrl.searchParams.set("error_description", errorDescription);
return NextResponse.redirect(redirectUrl.toString());
}
return NextResponse.redirect(