11"use client" ;
22
33import { useState } from "react" ;
4- import { resetPassword , checkEmailExists } from "@/lib/firebase/auth" ;
4+ import { resetPassword } from "@/lib/firebase/auth" ;
55import Link from "next/link" ;
66import { Mail , ArrowLeft } from "lucide-react" ;
77import { useToast } from "@/context/ToastContext" ;
@@ -24,19 +24,14 @@ export default function ForgotPasswordPage() {
2424 }
2525
2626 try {
27- // Check if email exists in Firebase Auth
28- const emailExists = await checkEmailExists ( email ) ;
29-
30- if ( ! emailExists ) {
31- addToast ( "We couldn't find an account with this email address." , "error" ) ;
32- setLoading ( false ) ;
33- return ;
34- }
35-
36- // Email exists - send password reset link
27+ // Standard Security Practice:
28+ // We blindly send the reset request. Firebase handles existence checks internally.
29+ // If the user exists, they get an email. If not, nothing happens.
30+ // We always show success to prevent email enumeration attacks and ensure valid users aren't blocked by API protections.
3731 await resetPassword ( email ) ;
38- addToast ( "Password reset link has been sent to your email." , "success" ) ;
39- setEmail ( "" ) ; // Clear the email field
32+
33+ addToast ( "If an account exists with this email, a password reset link has been sent." , "success" ) ;
34+ setEmail ( "" ) ; // Clear form
4035 } catch ( err : any ) {
4136 console . error ( "Error in handleReset:" , err ) ;
4237 addToast ( "Something went wrong. Please try again later." , "error" ) ;
0 commit comments