import type { Metadata } from "next"; import NextLink from "next/link"; import { Link } from "@unlocalhosted/metalui"; import { ResetPasswordForm } from "@/components/auth-forms"; import { KeyIcon } from "@/components/icons"; import { Alert, Box } from "@/components/ui"; import { passwordResetUser } from "@/lib/emails"; export const metadata: Metadata = { title: "Choose a new password" }; /** Where the link in a password reset email (lib/emails.ts) leads. */ export default async function ResetPasswordPage({ searchParams }: PageProps<"/login/reset-password">) { const token = (await searchParams).token; const user = typeof token === "string" ? await passwordResetUser(token) : null; return (

Choose a new password

{user &&

For @{user.username}

}
{user && typeof token === "string" ? ( ) : ( This link has expired or was already used. )}

{user ? ( }>Back to sign in ) : ( }>Ask for a new link )}

); }