71 lines
2.3 KiB
TypeScript
71 lines
2.3 KiB
TypeScript
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>
|
||
);
|
||
}
|