27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { redirect } from "next/navigation";
|
||
import { currentUser, safeNext } from "@/lib/auth";
|
||
import { Brand } from "@/components/Brand";
|
||
import { Flash } from "@/components/common";
|
||
import { Footer } from "@/components/Footer";
|
||
import { Button } from "@/components/ui/button";
|
||
|
||
export const dynamic = "force-dynamic";
|
||
|
||
export default async function Login({ searchParams }: { searchParams: Promise<{ error?: string; next?: string }> }) {
|
||
const { error, next } = await searchParams;
|
||
if (await currentUser()) redirect(safeNext(next));
|
||
return (
|
||
<main className="grid min-h-dvh place-items-center px-4">
|
||
<div className="flex w-full max-w-sm flex-col items-center gap-5 text-center">
|
||
<Brand large />
|
||
<p className="m-0 text-sm text-muted-foreground">Софтвейр-фабрика: проекты в Gitea, задачи по OpenSpec, агенты Claude Code и Codex.</p>
|
||
<Flash error={error} />
|
||
<Button asChild variant="default" size="lg" className="w-full">
|
||
<a href={`/auth/start?next=${encodeURIComponent(safeNext(next))}`}>Войти через Gitea</a>
|
||
</Button>
|
||
<Footer />
|
||
</div>
|
||
</main>
|
||
);
|
||
}
|