diff --git a/LICENSE b/LICENSE index a3d465b..1374210 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 Tuluobo +Copyright (c) 2025 Tuluobo Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/app/()/page.tsx b/src/app/()/page.tsx index 4f8ea43..eeec66a 100644 --- a/src/app/()/page.tsx +++ b/src/app/()/page.tsx @@ -33,7 +33,7 @@ export default function IndexPage() { 开始使用 - + - + + {client.redirectUri} + + +
+ + +
))} diff --git a/src/app/(dashboard)/dashboard/page.tsx b/src/app/(dashboard)/dashboard/page.tsx index 2ce2dc0..fef08f8 100644 --- a/src/app/(dashboard)/dashboard/page.tsx +++ b/src/app/(dashboard)/dashboard/page.tsx @@ -42,9 +42,11 @@ export default function DashboardPage() { - + + + diff --git a/src/app/(dashboard)/dashboard/settings/page.tsx b/src/app/(dashboard)/dashboard/settings/page.tsx new file mode 100644 index 0000000..708a7e5 --- /dev/null +++ b/src/app/(dashboard)/dashboard/settings/page.tsx @@ -0,0 +1,62 @@ +import { redirect } from "next/navigation"; + +import { getCurrentUser } from "@/lib/session"; +import { + Card, + CardContent, + CardDescription, + CardHeader, + CardTitle, +} from "@/components/ui/card"; + +export default async function SettingsPage() { + const user = await getCurrentUser(); + if (!user) { + redirect("/sign-in"); + } + + return ( +
+ + + 个人资料 + 查看和管理您的个人信息 + + +
+

用户名

+

{user.username}

+
+
+

邮箱

+

{user.email}

+
+
+

昵称

+

{user.name || "-"}

+
+
+

角色

+

+ {user.role === "ADMIN" ? "管理员" : "普通用户"} +

+
+
+

论坛版主

+

+ {user.moderator ? "是" : "否"} +

+
+ {user.groups && user.groups.length > 0 && ( +
+

用户组

+

+ {user.groups.join(", ")} +

+
+ )} +
+
+
+ ); +} diff --git a/src/types/next-auth.d.ts b/src/types/next-auth.d.ts index cb80056..5893dbd 100644 --- a/src/types/next-auth.d.ts +++ b/src/types/next-auth.d.ts @@ -6,6 +6,8 @@ export type ExtendedUser = User & { username?: string; avatarUrl?: string; role: UserRole; + moderator: boolean; + groups: string[]; }; declare module "next-auth/jwt" { @@ -13,6 +15,8 @@ declare module "next-auth/jwt" { username?: string; avatarUrl?: string; role: UserRole; + moderator: boolean; + groups: string[]; } }