Skip to content

Commit fec7f1d

Browse files
committed
feat: add check for bootstrap tokens
1 parent 3e21d58 commit fec7f1d

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/views/Login.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff 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) {

0 commit comments

Comments
 (0)