Skip to content

: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.

1.2 KB
Raw Blame
import { useActions, useValues } from 'kea'

import { LemonButton } from '@posthog/lemon-ui'

import { timeSensitiveAuthenticationLogic } from './timeSensitiveAuthenticationLogic'

export function SetPasswordLinkPrompt(): JSX.Element {
    const { setPasswordLinkSentTo, setPasswordLinkSentToLoading } = useValues(timeSensitiveAuthenticationLogic)
    const { sendSetPasswordLink } = useActions(timeSensitiveAuthenticationLogic)

    return (
        <div className="mt-4 flex justify-center text-center text-secondary">
            {setPasswordLinkSentTo ? (
                <p className="m-0">
                    We sent a link to <b>{setPasswordLinkSentTo}</b>. Open it to set a password, then sign in with your
                    new password.
                </p>
            ) : (
                <LemonButton
                    type="tertiary"
                    size="small"
                    htmlType="button"
                    loading={setPasswordLinkSentToLoading}
                    onClick={sendSetPasswordLink}
                    data-attr="reauth-set-password-link"
                >
                    Can't use your passkey? Email me a link to set a password
                </LemonButton>
            )}
        </div>
    )
}