@@ -4,6 +4,7 @@ import { Card } from '../components/Card';
44import { Select } from '../components/Select' ;
55import { Input } from '../components/Input' ;
66import { Button } from '../components/Button' ;
7+ import { maskEmail } from '../utils/auth' ;
78
89interface ForgotInfoProps {
910 onNavigate : ( page : string ) => void ;
@@ -15,6 +16,7 @@ export function ForgotInfo({ onNavigate }: ForgotInfoProps) {
1516 const [ isLoading , setIsLoading ] = useState ( false ) ;
1617 const [ success , setSuccess ] = useState ( false ) ;
1718 const [ error , setError ] = useState ( '' ) ;
19+ const [ submittedEmail , setSubmittedEmail ] = useState ( '' ) ;
1820
1921 const typeOptions = [
2022 { value : 'email' , label : 'البريد الإلكتروني' } ,
@@ -27,6 +29,7 @@ export function ForgotInfo({ onNavigate }: ForgotInfoProps) {
2729 setIsLoading ( true ) ;
2830 setError ( '' ) ;
2931 setSuccess ( false ) ;
32+ setSubmittedEmail ( '' ) ;
3033
3134 try {
3235 const response = await fetch ( '/api/auth/forgot-password' , {
@@ -43,6 +46,10 @@ export function ForgotInfo({ onNavigate }: ForgotInfoProps) {
4346 const data = await response . json ( ) ;
4447
4548 if ( data . success ) {
49+ // Store the email for masking in success message if type is email
50+ if ( type === 'email' ) {
51+ setSubmittedEmail ( value ) ;
52+ }
4653 setSuccess ( true ) ;
4754 } else {
4855 setError ( data . error || 'Request failed' ) ;
@@ -87,7 +94,15 @@ export function ForgotInfo({ onNavigate }: ForgotInfoProps) {
8794 < div className = "mb-4 p-4 bg-green-100 border border-green-400 text-green-700 rounded" >
8895 < h3 className = "font-medium mb-2" > تم إرسال الطلب</ h3 >
8996 < p className = "text-sm" >
90- إذا كانت المعلومات المقدمة صحيحة، سيتم إرسال تفاصيل العضوية إلى عنوان بريدك الإلكتروني.
97+ إذا كانت المعلومات المقدمة صحيحة، سيتم إرسال تفاصيل العضوية إلى عنوان بريدك الإلكتروني
98+ { submittedEmail && (
99+ < >
100+ < br />
101+ < span className = "font-mono text-xs mt-1 block" >
102+ { maskEmail ( submittedEmail ) }
103+ </ span >
104+ </ >
105+ ) }
91106 </ p >
92107 </ div >
93108
0 commit comments