import type { Metadata } from 'next'; import Link from 'next/link'; import { Trans, msg } from '@lingui/macro'; import { useLingui } from '@lingui/react'; import { setupI18nSSR } from '@documenso/lib/client-only/providers/i18n.server'; import { getRequiredServerComponentSession } from '@documenso/lib/next-auth/get-server-component-session'; import { getServerComponentFlag } from '@documenso/lib/server-only/feature-flags/get-server-component-feature-flag'; import { Alert, AlertDescription, AlertTitle } from '@documenso/ui/primitives/alert'; import { Button } from '@documenso/ui/primitives/button'; import { SettingsHeader } from '~/components/(dashboard)/settings/layout/header'; import { DisableAuthenticatorAppDialog } from '~/components/forms/2fa/disable-authenticator-app-dialog'; import { EnableAuthenticatorAppDialog } from '~/components/forms/2fa/enable-authenticator-app-dialog'; import { ViewRecoveryCodesDialog } from '~/components/forms/2fa/view-recovery-codes-dialog'; import { PasswordForm } from '~/components/forms/password'; export const metadata: Metadata = { title: 'Security', }; export default async function SecuritySettingsPage() { setupI18nSSR(); const { _ } = useLingui(); const { user } = await getRequiredServerComponentSession(); const isPasskeyEnabled = await getServerComponentFlag('app_passkey'); return (
{user.identityProvider === 'DOCUMENSO' && ( <>
)}
Two factor authentication {user.identityProvider === 'DOCUMENSO' ? ( Add an authenticator to serve as a secondary authentication method when signing in, or when signing documents. ) : ( Add an authenticator to serve as a secondary authentication method for signing documents. )}
{user.twoFactorEnabled ? ( ) : ( )}
{user.twoFactorEnabled && (
Recovery codes Two factor authentication recovery codes are used to access your account in the event that you lose access to your authenticator app.
)} {isPasskeyEnabled && (
Passkeys Allows authenticating using biometrics, password managers, hardware keys, etc.
)}
Recent activity View all recent security activity related to your account.
); }