@@ -58,7 +58,11 @@ const ResendVerificationForm = () => {
5858 toast ( { title : "Email Sent" , description : result . message } ) ;
5959 router . push ( '/' ) ;
6060 } else {
61- toast ( { variant : "destructive" , title : "Failed to send" , description : result . error } ) ;
61+ let errorMsg = result . error ;
62+ if ( errorMsg && errorMsg . toLowerCase ( ) . includes ( 'already verified' ) ) {
63+ errorMsg = "This email is already verified. Please log in." ;
64+ }
65+ toast ( { variant : "destructive" , title : "Failed to send" , description : errorMsg } ) ;
6266 }
6367 } catch ( error ) {
6468 toast ( { variant : "destructive" , title : "Network Error" , description : "Could not connect to the server." } ) ;
@@ -203,11 +207,42 @@ const ActionHandlerContent: React.FC = () => {
203207
204208 if ( success ) {
205209 if ( info ?. from === 'verifyEmail' ) {
206- toast ( {
207- title : "Email Verified!" ,
208- description : "Your account is now active. You can log in." ,
209- } ) ;
210- router . push ( '/?action=login&from=verification_success' ) ;
210+ // After verification, check if profile is complete
211+ ( async ( ) => {
212+ try {
213+ const response = await fetch ( `${ API_BASE_URL } /api/check-profile` , {
214+ method : 'POST' ,
215+ headers : { 'Content-Type' : 'application/json' } ,
216+ body : JSON . stringify ( { email : info . email } )
217+ } ) ;
218+ const data = await response . json ( ) ;
219+ if ( response . ok && data . profileComplete ) {
220+ toast ( {
221+ title : "Email Verified!" ,
222+ description : "Your account is now active. You can log in." ,
223+ } ) ;
224+ router . push ( '/?action=login&from=verification_success' ) ;
225+ } else if ( data . token ) {
226+ toast ( {
227+ title : "Email Verified!" ,
228+ description : "Please complete your profile to continue." ,
229+ } ) ;
230+ router . push ( `/complete-profile?token=${ data . token } ` ) ;
231+ } else {
232+ toast ( {
233+ title : "Email Verified!" ,
234+ description : "Please complete your profile to continue." ,
235+ } ) ;
236+ router . push ( '/' ) ;
237+ }
238+ } catch ( e ) {
239+ toast ( {
240+ title : "Email Verified!" ,
241+ description : "Please log in." ,
242+ } ) ;
243+ router . push ( '/?action=login&from=verification_success' ) ;
244+ }
245+ } ) ( ) ;
211246 return null ;
212247 }
213248 if ( info ?. from === 'resetPassword' ) {
0 commit comments