import type { Metadata } from 'next'; import { redirect } from 'next/navigation'; import { getPending } from '@/lib/auth/pending'; import { MfaForm } from './mfa-form'; export const metadata: Metadata = { title: 'Two-step verification', robots: { index: false } }; export default async function MfaPage() { const p = await getPending(); if (!p) redirect('/login?expired=1'); if (p.stage === 'verify') redirect('/verify'); return ( <>

Two-step verification

{p.stage === 'totp' ? 'Enter the 6-digit code from your authenticator app.' : <>We e-mailed a 6-digit sign-in code to {p.email} because this device is new.}

); }