Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions app/[locale]/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import type { Metadata } from "next";
import { Suspense } from "react";
import { setRequestLocale, getTranslations } from "next-intl/server";
import { hasLocale } from "next-intl";
import { notFound } from "next/navigation";
import { SignInButton } from "@/app/components/SignInButton";
import { LoginErrorNotice } from "@/app/components/LoginErrorNotice";
import { routing } from "@/i18n/routing";

// SEO: 登录页不参与 index(搜索引擎不需要收录登录入口)
Expand Down Expand Up @@ -30,11 +32,20 @@ export default async function LoginPage({ params }: Props) {
<h1 className="text-3xl font-bold">{t("heading")}</h1>
<p className="text-muted-foreground">{t("subheading")}</p>
</div>
<Suspense fallback={null}>
<LoginErrorNotice
messages={{
discord_canary: t("errorDiscordCanary"),
generic: t("errorGeneric"),
}}
/>
</Suspense>
<div className="flex flex-col items-center gap-3">
<SignInButton provider="github" label={t("github")} />
{/* Discord 登录暂时下线:后端 provider 已就绪,但新用户"验证邮箱→建号"
流程(OTP wiring)还没做完,先不对外暴露以免分叉账号。做完后取消注释即可。 */}
{/* <SignInButton provider="discord" label={t("discord")} /> */}
{/* Discord 登录灰度中:后端按 Discord id 白名单放行(auth.discord.allowlist),
名单外的人点了会被回调弹回 /login?error=discord_canary。GA(OTP wiring 完成、
清空白名单)后此按钮即对所有人开放。 */}
<SignInButton provider="discord" label={t("discord")} />
</div>
</div>
</div>
Expand Down
25 changes: 25 additions & 0 deletions app/components/LoginErrorNotice.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"use client";

import { useSearchParams } from "next/navigation";

// 登录页顶端的错误提示。后端 OAuth 回调失败会 302 到 /login?error=xxx。
// 用 useSearchParams(客户端读 query)而非 server 读 searchParams,避免整页退回
// 动态渲染(登录页要保持 SSG,见 CLAUDE.md 路由分类约束)。父级用 <Suspense> 包裹。
// 文案由 server 端 getTranslations 取好后作为 prop 传入,省一套 client i18n provider。
export function LoginErrorNotice({
messages,
}: {
messages: Record<string, string>;
}) {
const error = useSearchParams().get("error");
if (!error) return null;
const msg = messages[error] ?? messages.generic;
return (
<div
role="alert"
className="w-full rounded-md border border-amber-300 bg-amber-50 px-4 py-3 text-sm text-amber-900 dark:border-amber-800 dark:bg-amber-950 dark:text-amber-200"
>
{msg}
</div>
);
}
10 changes: 5 additions & 5 deletions generated/doc-contributors.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"repo": "InvolutionHell/involutionhell",
"generatedAt": "2026-05-24T18:19:10.363Z",
"generatedAt": "2026-07-24T13:55:10.610Z",
"docsDir": "content/docs",
"totalDocs": 144,
"results": [
Expand Down Expand Up @@ -2196,9 +2196,9 @@
"githubId": "123258594",
"contributions": 2,
"lastContributedAt": "2025-09-29T10:32:11.000Z",
"login": "PenghaoJiang",
"login": "OvOhao",
"avatarUrl": "https://avatars.githubusercontent.com/u/123258594?v=4",
"htmlUrl": "https://github.com/PenghaoJiang"
"htmlUrl": "https://github.com/OvOhao"
},
{
"githubId": "41898282",
Expand Down Expand Up @@ -2816,9 +2816,9 @@
"githubId": "76551253",
"contributions": 1,
"lastContributedAt": "2025-10-06T00:30:18.000Z",
"login": "840691168",
"login": "YangLiu-Lewis",
"avatarUrl": "https://avatars.githubusercontent.com/u/76551253?v=4",
"htmlUrl": "https://github.com/840691168"
"htmlUrl": "https://github.com/YangLiu-Lewis"
}
]
},
Expand Down
4 changes: 3 additions & 1 deletion messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
"heading": "Sign In",
"subheading": "Sign in to access protected pages",
"github": "Sign in with GitHub",
"discord": "Sign in with Discord"
"discord": "Sign in with Discord",
"errorDiscordCanary": "Discord sign-in is in limited testing and not open yet — stay tuned!",
"errorGeneric": "Sign-in didn't complete. Please try again."
},
"settings": {
"theme": {
Expand Down
4 changes: 3 additions & 1 deletion messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@
"heading": "登录",
"subheading": "请登录以访问受保护的页面",
"github": "用 GitHub 登录",
"discord": "用 Discord 登录"
"discord": "用 Discord 登录",
"errorDiscordCanary": "Discord 登录正在灰度测试中,暂未对外开放,敬请期待~",
"errorGeneric": "登录未完成,请重试。"
},
"settings": {
"theme": {
Expand Down
Loading