Password Reset
This page provides examples of how to create custom password reset pages for your application. Password reset functionality allows users to securely create a new password when they’ve forgotten their current one.
Custom page with PasswordReset
component
The PasswordReset
component provides a complete password reset form with built-in validation and error handling. This is the simplest way to add password reset functionality to your application.
Integration with Application Routing
To integrate the password reset page with your application’s routing:
- Create a route handler that extracts the reset code from the URL (e.g.,
/reset-password?code=xyz123
) - Pass the code to your password reset component
- Configure Stack Auth to use your custom route in your
stack.ts
file:
This ensures that password reset links in emails will direct users to your custom page.
Custom password reset form
If you need more control over the password reset process, you can build your own form using the Stack Auth API. This approach allows you to customize the UI and error handling to match your application’s design.
The code
parameter used below is typically extracted from the URL query parameters. This code is sent to the user’s email when they request a password reset and is required to validate the reset request.