Main Component
PasswordReset
A React component that provides a password reset form for users who have forgotten their password. Integrates with Firebase Authentication to send password reset emails.
Props:
-
isModal?: boolean
If true, renders the form as a modal overlay. If false or omitted, renders as a standalone page. -
onBack: () => void
Callback function to return to the previous screen or close the modal.
State:
-
error
: Stores error or success messages for user feedback. -
isLoading
: Indicates if the reset email is being sent.
Key Functions:
- handleReset
Handles form submission. Sends a password reset email using Firebase. Displays a success message and automatically callsonBack
after 2 seconds, or shows an error if sending fails.
UI Structure:
-
If
isModal
is true, displays the form in a modal overlay. -
Otherwise, displays the form as a full page with a logo link and styled container.
Form Fields:
-
Email input (required)
-
Submit button (disabled while loading)
-
Back button (calls
onBack
)
Error Handling:
-
Uses
handleAuthError
to translate Firebase errors into user-friendly messages. -
Displays a success message when the reset email is sent.