File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ const Login: React.FC = () => {
2424 const [ identifierError , setIdentifierError ] = useState < string > ( '' ) ;
2525 const [ passkeyAvailable , setPasskeyAvailable ] = useState ( false ) ;
2626 const [ showFallbackOptions , setShowFallbackOptions ] = useState ( false ) ;
27+ const [ bootstrapToken , setBootstrapToken ] = useState < string | null > ( null ) ;
2728
2829 const fetchWithAuth = createFetchWithAuth ( {
2930 authMode,
@@ -41,6 +42,14 @@ const Login: React.FC = () => {
4142 if ( hasSignedInBefore ) {
4243 setMode ( 'login' ) ;
4344 }
45+
46+ const params = new URLSearchParams ( window . location . search ) ;
47+ const token = params . get ( 'bootstrapToken' ) ;
48+
49+ if ( token && token . length > 10 ) {
50+ setBootstrapToken ( token ) ;
51+ console . log ( 'Bootstrap token detected in URL' ) ;
52+ }
4453 } , [ hasSignedInBefore ] ) ;
4554
4655 const handleEmailChange = ( e : React . ChangeEvent < HTMLInputElement > ) => {
@@ -134,7 +143,11 @@ const Login: React.FC = () => {
134143 try {
135144 const response = await fetchWithAuth ( `/registration/register` , {
136145 method : 'POST' ,
137- body : JSON . stringify ( { email, phone } ) ,
146+ body : JSON . stringify ( {
147+ email,
148+ phone,
149+ ...( bootstrapToken ? { bootstrapToken } : { } ) ,
150+ } ) ,
138151 } ) ;
139152
140153 if ( ! response . ok ) {
You can’t perform that action at this time.
0 commit comments