hy2-panel/app/login/page.tsx
2026-04-14 18:05:32 +08:00

71 lines
2.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import type { Metadata } from "next";
import { redirect } from "next/navigation";
import { getAdminSession, getUserSession } from "@/lib/session";
import { loginAction } from "./actions";
export const metadata: Metadata = {
title: "鹅梯 FeieProxy",
};
export default async function LoginPage({
searchParams,
}: {
searchParams: Promise<{ error?: string }>;
}) {
const [adminSession, userSession] = await Promise.all([
getAdminSession(),
getUserSession(),
]);
if (adminSession) {
redirect("/admin/dashboard");
}
if (userSession) {
redirect("/me");
}
const params = await searchParams;
return (
<main className="login-shell login-shell--immersive">
<div aria-hidden="true" className="login-backdrop">
<span className="login-orb login-orb--one" />
<span className="login-orb login-orb--two" />
<span className="login-orb login-orb--three" />
</div>
<section className="login-stage">
<article className="login-card login-card--form login-card--brand">
<div className="section-title">
<div>
<span className="eyebrow">FEIEPROXY ACCESS</span>
<h1> FeieProxy</h1>
</div>
<span className="status-pill status-pill--neutral"></span>
</div>
<p className="page-lede">
Clash
</p>
<form action={loginAction} className="stack-lg login-form">
<label className="field">
<span></span>
<input name="username" type="text" placeholder="admin" required />
</label>
<label className="field">
<span></span>
<input name="password" type="password" required />
</label>
{params.error ? (
<p className="error-banner"></p>
) : null}
<button className="primary-button" type="submit">
</button>
</form>
<p className="login-note"></p>
</article>
</section>
</main>
);
}