File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,15 +83,34 @@ export function LoginForm({
8383 async function resendVerification ( ) {
8484 if ( ! email ) return ;
8585
86- await fetch ( "/api/auth/resend-verification" , {
87- method : "POST" ,
88- headers : { "Content-Type" : "application/json" } ,
89- body : JSON . stringify ( { email } ) ,
90- } ) ;
86+ try {
87+ const res = await fetch ( "/api/auth/resend-verification" , {
88+ method : "POST" ,
89+ headers : { "Content-Type" : "application/json" } ,
90+ body : JSON . stringify ( { email } ) ,
91+ } ) ;
9192
92- setVerificationSent ( true ) ;
93- setErrorCode ( null ) ;
94- setErrorMessage ( null ) ;
93+ const data = await res . json ( ) . catch ( ( ) => null ) ;
94+
95+ if ( ! res . ok ) {
96+ setErrorCode ( data ?. code ?? "RESEND_FAILED" ) ;
97+ setErrorMessage (
98+ data ?. error ??
99+ "Failed to resend verification email. Please try again."
100+ ) ;
101+ return ;
102+ }
103+
104+ setVerificationSent ( true ) ;
105+ setErrorCode ( null ) ;
106+ setErrorMessage ( null ) ;
107+ } catch ( err ) {
108+ console . error ( "Resend verification failed:" , err ) ;
109+ setErrorCode ( "NETWORK_ERROR" ) ;
110+ setErrorMessage (
111+ "Network error. Please check your connection and try again."
112+ ) ;
113+ }
95114 }
96115
97116 return (
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ export function getSafeRedirect(
33) : string {
44 if ( ! raw ) return "" ;
55
6+ if ( raw . includes ( "\\" ) ) return "" ;
7+
68 if ( ! raw . startsWith ( "/" ) ) return "" ;
79 if ( raw . startsWith ( "//" ) ) return "" ;
810 if ( raw . includes ( "://" ) ) return "" ;
You can’t perform that action at this time.
0 commit comments