:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(auth): tidy paper-desk verify-email and invite signup (#65575)
Fernando Gomese46bbd1d0211
diff --git a/frontend/src/scenes/authentication/invite-signup/variants/paper-desk/PaperDeskInviteSignup.tsx b/frontend/src/scenes/authentication/invite-signup/variants/paper-desk/PaperDeskInviteSignup.tsxindex fc7004f8af26..ee891d41bfa2 100644--- a/frontend/src/scenes/authentication/invite-signup/variants/paper-desk/PaperDeskInviteSignup.tsx+++ b/frontend/src/scenes/authentication/invite-signup/variants/paper-desk/PaperDeskInviteSignup.tsx@@ -6,9 +6,12 @@ import { PostHogLogo } from 'lib/brand/v2'import { JudgeHog } from 'lib/components/hedgehogs'import PasswordStrength from 'lib/components/PasswordStrength'import SignupRoleSelect from 'lib/components/SignupRoleSelect'-import { SocialLoginButtons, SSOEnforcedLoginButton } from 'lib/components/SocialLoginButton/SocialLoginButton'+import passkeyLogo from 'lib/components/SocialLoginButton/passkey.svg'+import { SocialLoginButton, SSOEnforcedLoginButton } from 'lib/components/SocialLoginButton/SocialLoginButton'import { supportLogic } from 'lib/components/Support/supportLogic'+import { SSO_PROVIDER_NAMES } from 'lib/constants'import { LemonButton } from 'lib/lemon-ui/LemonButton'+import { LemonDivider } from 'lib/lemon-ui/LemonDivider'import { LemonField } from 'lib/lemon-ui/LemonField'import { LemonInput } from 'lib/lemon-ui/LemonInput/LemonInput'import { Link } from 'lib/lemon-ui/Link'@@ -19,13 +22,71 @@ import { CardTitle } from 'scenes/authentication/shared/paperDesk/CardTitle'import { OrgTile } from 'scenes/authentication/shared/paperDesk/OrgTile'import { PaperDeskCard, PaperDeskScene } from 'scenes/authentication/shared/paperDesk/PaperDeskScene'import { TurnstileChallenge } from 'scenes/authentication/signup/signupForm/TurnstileChallenge'+import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'import { urls } from 'scenes/urls'import { userLogic } from 'scenes/userLogic'-import { PrevalidatedInvite } from '~/types'+import { PrevalidatedInvite, SSOProvider } from '~/types'import { ErrorCodes, inviteSignupLogic } from '../../inviteSignupLogic'+/**+ * Invite-signup alternatives row: social/SSO icons plus an optional passkey signup icon.+ * The passkey button is assembled here (not in SocialLoginButtons) because a passkey isn't a social login.+ */+function InviteAlternativeLogins({+ invite,+ showPasskey,+ onRegisterPasskey,+ passkeyRegistering,+}: {+ invite: PrevalidatedInvite+ showPasskey: boolean+ onRegisterPasskey: () => void+ passkeyRegistering: boolean+}): JSX.Element | null {+ const { preflight, socialAuthAvailable } = useValues(preflightLogic)++ const order = Object.keys(SSO_PROVIDER_NAMES)+ const socialProviders =+ socialAuthAvailable && preflight+ ? Object.keys(preflight.available_social_auth_providers).sort((a, b) => order.indexOf(a) - order.indexOf(b))+ : []++ if (!socialProviders.length && !showPasskey) {+ return null+ }++ return (+ <>+ <LemonDivider dashed className="my-4" />+ <div className="text-center deprecated-space-y-4">+ <p className="text-secondary">or continue with</p>+ <div className="flex gap-4 justify-center flex-wrap">+ {socialProviders.map((provider) => (+ <SocialLoginButton+ key={provider}+ provider={provider as SSOProvider}+ extraQueryParams={{ invite_id: invite.id }}+ />+ ))}+ {showPasskey && (+ <LemonButton+ size="large"+ htmlType="button"+ icon={<img src={passkeyLogo} alt="Passkey" className="object-contain w-7 h-7" />}+ tooltip="Sign up with a passkey"+ onClick={onRegisterPasskey}+ loading={passkeyRegistering}+ data-attr="invite-signup-passkey"+ />+ )}+ </div>+ </div>+ </>+ )+}+function InviteNewUser({ invite }: { invite: PrevalidatedInvite }): JSX.Element {const {isSignupSubmitting,@@ -121,18 +182,6 @@ function InviteNewUser({ invite }: { invite: PrevalidatedInvite }): JSX.Element{!extraFieldsHidden && (<>- {passkeySignupEnabled && !passkeyRegistered && (- <LemonButton- size="large"- center- fullWidth- onClick={registerPasskey}- disabled={isPasskeyRegistering}- data-attr="invite-signup-passkey"- >- Sign up with a passkey- </LemonButton>- )}{!passkeyRegistered && (<LemonFieldname="password"@@ -217,11 +266,11 @@ function InviteNewUser({ invite }: { invite: PrevalidatedInvite }): JSX.Element)}</Form>{!extraFieldsHidden && (- <SocialLoginButtons- topDivider- caption="or continue with"- captionLocation="top"- extraQueryParams={{ invite_id: invite.id }}+ <InviteAlternativeLogins+ invite={invite}+ showPasskey={passkeySignupEnabled && !passkeyRegistered}+ onRegisterPasskey={() => registerPasskey()}+ passkeyRegistering={isPasskeyRegistering}/>)}</PaperDeskCard>diff --git a/frontend/src/scenes/authentication/verify-email/variants/paper-desk/PaperDeskVerifyEmail.tsx b/frontend/src/scenes/authentication/verify-email/variants/paper-desk/PaperDeskVerifyEmail.tsxindex 6247f246e00b..fe79938e5ad5 100644--- a/frontend/src/scenes/authentication/verify-email/variants/paper-desk/PaperDeskVerifyEmail.tsx+++ b/frontend/src/scenes/authentication/verify-email/variants/paper-desk/PaperDeskVerifyEmail.tsx@@ -26,9 +26,15 @@ const CHECKLIST = [function NotSeeingIt(): JSX.Element {const { openSupportForm } = useActions(supportLogic)+ const { requestVerificationLink } = useActions(verifyEmailLogic)+ const { uuid, newlyRequestedVerificationLinkLoading } = useValues(verifyEmailLogic)const [open, setOpen] = useState(false)const [checked, setChecked] = useState<boolean[]>([])const allChecked = CHECKLIST.every((_, i) => checked[i])+ // Like legacy: the resend (and support) stay gated behind the checklist so they can't be spammed.+ const gateReason = !allChecked+ ? `Confirm the checks above (${checked.filter(Boolean).length}/${CHECKLIST.length})`+ : undefinedreturn (<>@@ -41,7 +47,7 @@ function NotSeeingIt(): JSX.Element {</button>{open && (<div className="PaperDesk__note mt-3 w-full py-3 px-3.5 text-xs leading-relaxed text-secondary text-left bg-[#fbfbf9] border border-dashed border-[#c5c6bd] rounded">- <p className="m-0 mb-2.5 font-semibold text-primary">Before we escalate, three quick checks:</p>+ <p className="m-0 mb-2.5 font-semibold text-primary">Before we resend, three quick checks:</p><div className="flex flex-col gap-2">{CHECKLIST.map((item, i) => (<label key={i} className="flex items-start gap-2.5">@@ -60,23 +66,35 @@ function NotSeeingIt(): JSX.Element {</label>))}</div>- <LemonButton- size="large"- center- className="mt-3"- fullWidth- disabledReason={- !allChecked ? `Contact support (${checked.filter(Boolean).length}/3 checked)` : undefined- }- onClick={() =>- openSupportForm({- kind: 'bug',- target_area: 'login',- })- }- >- Contact support- </LemonButton>+ <div className="mt-3 flex flex-col gap-2">+ {uuid && (+ <LemonButton+ type="primary"+ size="large"+ center+ fullWidth+ loading={newlyRequestedVerificationLinkLoading}+ disabledReason={gateReason}+ onClick={() => requestVerificationLink(uuid)}+ >+ Resend email+ </LemonButton>+ )}+ <LemonButton+ size="large"+ center+ fullWidth+ disabledReason={gateReason}+ onClick={() =>+ openSupportForm({+ kind: 'bug',+ target_area: 'login',+ })+ }+ >+ Contact support+ </LemonButton>+ </div></div>)}</>@@ -84,7 +102,7 @@ function NotSeeingIt(): JSX.Element {}function VerifyEmail(): JSX.Element {- const { view, uuid, user } = useValues(verifyEmailLogic)+ const { view, uuid, newlyRequestedVerificationLinkLoading } = useValues(verifyEmailLogic)const { requestVerificationLink } = useActions(verifyEmailLogic)const { openSupportForm } = useActions(supportLogic)@@ -144,6 +162,7 @@ function VerifyEmail(): JSX.Element {size="large"centerfullWidth+ loading={newlyRequestedVerificationLinkLoading}onClick={() => requestVerificationLink(uuid)}>Email me a new link@@ -205,31 +224,10 @@ function VerifyEmail(): JSX.Element {<h1 className="m-0 mt-3 font-title text-2xl font-extrabold leading-tight text-primary text-center tracking-tight">Check your inbox</h1>- <p className="PaperDesk__sub mt-2 mb-2.5 text-sm text-secondary text-center text-pretty">- We sent a verification link to+ <p className="PaperDesk__sub mt-2 mb-4 text-sm text-secondary text-center text-pretty">+ We sent you a verification link. Click the link inside and you're in — it's valid for 24 hours.</p>- {user?.email && (- <span className="mb-4 inline-block py-1 px-2.5 font-mono text-sm font-regular text-primary bg-[#fbfbf9] border border-[#e0e1d9] rounded">- {user.email}- </span>- )}- <p className="PaperDesk__sub mt-0 mb-4 text-sm text-secondary text-center text-pretty">- Click the link inside and you're in. The link is valid for 24 hours.- </p>- {uuid && (- <LemonButton- type="primary"- size="large"- center- fullWidth- onClick={() => requestVerificationLink(uuid)}- >- Resend email- </LemonButton>- )}- <div className="mt-3.5">- <NotSeeingIt />- </div>+ <NotSeeingIt /></div></PaperDeskCard></PaperDeskScene>