diff --git a/src/components/AuthenticationFlow/EmailLoginForm.tsx b/src/components/AuthenticationFlow/EmailLoginForm.tsx index aa2bc9aa8..a348921e8 100644 --- a/src/components/AuthenticationFlow/EmailLoginForm.tsx +++ b/src/components/AuthenticationFlow/EmailLoginForm.tsx @@ -3,6 +3,7 @@ import type { FormEvent } from 'react'; import { useId, useState } from 'react'; import { httpPost } from '../../lib/http'; import { TOKEN_COOKIE_NAME, setAuthToken } from '../../lib/jwt'; +import { FIRST_LOGIN_TAG } from './TriggerVerifyAccount'; type EmailLoginFormProps = { isDisabled?: boolean; @@ -38,7 +39,9 @@ export function EmailLoginForm(props: EmailLoginFormProps) { const currentLocation = window.location.href; const url = new URL(currentLocation, window.location.origin); - url.searchParams.set('isNewUser', String(response?.isNewUser || false)); + if (response?.isNewUser) { + url.searchParams.set(FIRST_LOGIN_TAG, '1'); + } window.location.href = url.toString(); return; } diff --git a/src/components/AuthenticationFlow/GitHubButton.tsx b/src/components/AuthenticationFlow/GitHubButton.tsx index 84ee56f78..2daf89a20 100644 --- a/src/components/AuthenticationFlow/GitHubButton.tsx +++ b/src/components/AuthenticationFlow/GitHubButton.tsx @@ -5,6 +5,7 @@ import { TOKEN_COOKIE_NAME, setAuthToken } from '../../lib/jwt'; import { httpGet } from '../../lib/http'; import { Spinner } from '../ReactIcons/Spinner.tsx'; import { triggerUtmRegistration } from '../../lib/browser.ts'; +import { FIRST_LOGIN_TAG } from './TriggerVerifyAccount.tsx'; type GitHubButtonProps = { isDisabled?: boolean; @@ -76,7 +77,9 @@ export function GitHubButton(props: GitHubButtonProps) { setAuthToken(response.token); const url = new URL(redirectUrl, window.location.origin); - url.searchParams.set('isNewUser', String(response?.isNewUser || false)); + if (response?.isNewUser) { + url.searchParams.set(FIRST_LOGIN_TAG, '1'); + } window.location.href = url.toString(); }) .catch((err) => { diff --git a/src/components/AuthenticationFlow/GoogleButton.tsx b/src/components/AuthenticationFlow/GoogleButton.tsx index dae9c4307..a3ef581d4 100644 --- a/src/components/AuthenticationFlow/GoogleButton.tsx +++ b/src/components/AuthenticationFlow/GoogleButton.tsx @@ -8,6 +8,7 @@ import { getStoredUtmParams, triggerUtmRegistration, } from '../../lib/browser.ts'; +import { FIRST_LOGIN_TAG } from './TriggerVerifyAccount.tsx'; type GoogleButtonProps = { isDisabled?: boolean; @@ -80,7 +81,9 @@ export function GoogleButton(props: GoogleButtonProps) { setAuthToken(response.token); const url = new URL(redirectUrl, window.location.origin); - url.searchParams.set('isNewUser', String(response?.isNewUser || false)); + if (response?.isNewUser) { + url.searchParams.set(FIRST_LOGIN_TAG, '1'); + } window.location.href = url.toString(); }) .catch((err) => { diff --git a/src/components/AuthenticationFlow/LinkedInButton.tsx b/src/components/AuthenticationFlow/LinkedInButton.tsx index 028ca5cb8..956cc573a 100644 --- a/src/components/AuthenticationFlow/LinkedInButton.tsx +++ b/src/components/AuthenticationFlow/LinkedInButton.tsx @@ -5,6 +5,7 @@ import { httpGet } from '../../lib/http'; import { Spinner } from '../ReactIcons/Spinner.tsx'; import { LinkedInIcon } from '../ReactIcons/LinkedInIcon.tsx'; import { triggerUtmRegistration } from '../../lib/browser.ts'; +import { FIRST_LOGIN_TAG } from './TriggerVerifyAccount.tsx'; type LinkedInButtonProps = { isDisabled?: boolean; @@ -75,7 +76,9 @@ export function LinkedInButton(props: LinkedInButtonProps) { setAuthToken(response.token); const url = new URL(redirectUrl, window.location.origin); - url.searchParams.set('isNewUser', String(response?.isNewUser || false)); + if (response?.isNewUser) { + url.searchParams.set(FIRST_LOGIN_TAG, '1'); + } window.location.href = url.toString(); }) .catch((err) => { diff --git a/src/components/AuthenticationFlow/TriggerVerifyAccount.tsx b/src/components/AuthenticationFlow/TriggerVerifyAccount.tsx index 4ef698719..87627a42d 100644 --- a/src/components/AuthenticationFlow/TriggerVerifyAccount.tsx +++ b/src/components/AuthenticationFlow/TriggerVerifyAccount.tsx @@ -6,6 +6,8 @@ import { Spinner } from '../ReactIcons/Spinner'; import { ErrorIcon2 } from '../ReactIcons/ErrorIcon2'; import { triggerUtmRegistration } from '../../lib/browser.ts'; +export const FIRST_LOGIN_TAG = 'fl' as const; + export function TriggerVerifyAccount() { const [isLoading, setIsLoading] = useState(true); const [error, setError] = useState(''); @@ -32,7 +34,9 @@ export function TriggerVerifyAccount() { setAuthToken(response.token); const url = new URL('/', window.location.origin); - url.searchParams.set('isNewUser', String(response?.isNewUser || false)); + if (response?.isNewUser) { + url.searchParams.set(FIRST_LOGIN_TAG, '1'); + } window.location.href = url.toString(); }) .catch((err) => {