import type { Metadata } from "next"; import NextLink from "next/link"; import { redirect } from "next/navigation"; import { Link } from "@unlocalhosted/metalui"; import { TwoFactorLoginForm } from "@/components/auth-forms"; import { ShieldLockIcon } from "@/components/icons"; import { Box } from "@/components/ui"; import { getViewer, hasSignInChallenge, safeNext } from "@/lib/auth"; export const metadata: Metadata = { title: "Two-factor authentication" }; export default async function TwoFactorLoginPage({ searchParams }: PageProps<"/login/two-factor">) { const next = safeNext((await searchParams).next); if (await getViewer()) redirect(next); const login = `/login${next !== "/" ? `?next=${encodeURIComponent(next)}` : ""}`; if (!(await hasSignInChallenge())) redirect(login); return (

Two-factor authentication

Enter the code from your authenticator app

Not you? }>Sign in with another account

); }