Skip to content

PasswordResetForm

Set a new password from a reset token. Self-contained: runs useResetPassword, maps PasswordResetError (INVALID_TOKEN / TOKEN_NOT_FOUND) to a form-level message by code, and delegates session-setting to AuthProvider's onAuthenticated seam.

import { PasswordResetForm } from "@evolve-storefront/feature-auth/password-reset-form";

Renders inside AuthProvider.

Preview

DefaultOpen in Storybook ↗

Usage

// The token arrives as a query parameter on the emailed link.
const token = searchParams.get("token") ?? "";
<PasswordResetForm token={token} onPasswordChanged={() => router.push("/account")} />;

Props

PropTypeDescription
tokenstring

The reset token from the email link (e.g. ?token).

validationBehavior?"aria" | "native"

Default "aria": mark fields via ARIA rather than blocking native submit. The form is then noValidate, so an input's own constraint (type="email") never stops the submit with a browser tooltip that the field's error does not match.

onPasswordChanged?((customer: AuthCustomer) => void)

Any other props go to the root element, like on a plain HTML element.