TypeScript 61.9%
HTML 37.2%
SQL 0.7%
1import type { Metadata } from 'next';2import Link from 'next/link';3import { redirect } from 'next/navigation';4import { getCurrentUser } from '@/lib/auth/session';5import { safeNext } from '@/lib/auth/pending';6import { LoginForm } from './login-form';78export const metadata: Metadata = { title: 'Sign in', robots: { index: false } };910export default async function LoginPage({ searchParams }: { searchParams: Promise<Record<string, string | string[] | undefined>> }) {11 const sp = await searchParams;12 const next = safeNext(typeof sp.next === 'string' ? sp.next : null);13 const user = await getCurrentUser();14 if (user) redirect(next);15 return (16 <>17 <h1 className="text-xl font-semibold tracking-tight">Sign in</h1>18 <p className="mt-1 text-sm text-muted">Welcome back. Your collections, watchlists and alerts are waiting.</p>19 {sp.reset ? <p className="mt-4 rounded-md border border-gain/30 bg-gain-bg px-3 py-2 text-sm text-gain">Password updated. Sign in with your new password.</p> : null}20 {sp.expired ? <p className="mt-4 rounded-md border border-alert/30 bg-alert-bg px-3 py-2 text-sm text-alert">Your session expired. Please sign in again.</p> : null}21 <LoginForm next={next} />22 <p className="mt-6 text-center text-sm text-muted">23 New to RareIndex?{' '}24 <Link href={`/signup${next !== '/collections' ? `?next=${encodeURIComponent(next)}` : ''}`} className="font-medium text-fg underline-offset-4 hover:underline">25 Create an account26 </Link>27 </p>28 </>29 );30}31