@@ -648,6 +648,16 @@ <h2 style="margin:0 0 4px; font-size:22px; font-weight:500;">Link This Account</
648648 } else {
649649 document . cookie = "username=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;" ;
650650
651+ if ( account_data . requiresTOSAcceptance ) {
652+ // Redirect to TOS acceptance page with token and return_to
653+ const tosUrl = new URL ( './terms-of-service.html' , window . location . href ) ;
654+ tosUrl . searchParams . set ( 'token' , account_data . key ) ;
655+ if ( return_to ) {
656+ tosUrl . searchParams . set ( 'return_to' , return_to ) ;
657+ }
658+ window . location . href = tosUrl . toString ( ) ;
659+ return ;
660+ }
651661 submitButton . innerHTML = account_data && account_data . error ? account_data . error : 'Invalid credentials' ;
652662 submitButton . style . background = '#ea4335' ;
653663
@@ -748,6 +758,16 @@ <h2 style="margin:0 0 4px; font-size:22px; font-weight:500;">Link This Account</
748758 saveAccount ( account_data ) ;
749759 updateModalForLoggedInUser ( ) ;
750760 } else {
761+ if ( account_data . requiresTOSAcceptance ) {
762+ // Redirect to TOS acceptance page with token and return_to
763+ const tosUrl = new URL ( './terms-of-service.html' , window . location . href ) ;
764+ tosUrl . searchParams . set ( 'token' , account_data . key ) ;
765+ if ( return_to ) {
766+ tosUrl . searchParams . set ( 'return_to' , return_to ) ;
767+ }
768+ window . location . href = tosUrl . toString ( ) ;
769+ return ;
770+ }
751771 // Fallback to signin form if auto-login fails
752772 submitButton . innerHTML = 'Account created! Please sign in' ;
753773 submitButton . style . background = '#34a853' ;
0 commit comments