import { redirect } from 'next/navigation'; import { ResetPasswordForm } from './reset-password-form'; /** * The email Brainerce sends links to `/reset-password?token=...`. * That token must never reach client JavaScript, so this server component hands * it to `/api/auth/reset-callback`, which stores it in an httpOnly cookie and * returns here with a clean URL. The form then posts the new password through * `/api/auth/reset-password`, which reads the cookie server-side. * * Without this hop the page rendered with no cookie and every reset failed with * "No reset token found", because the callback route was only ever reached by a * `resetUrl` option the SDK does not send. */ export default async function ResetPasswordPage({ searchParams, }: { searchParams: Promise<{ token?: string }>; }) { const { token } = await searchParams; if (token) { redirect(`/api/auth/reset-callback?token=${encodeURIComponent(token)}`); } return ; }