mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-17 14:33:41 +08:00
整体优化认证
This commit is contained in:
13
lib/auth_client.ts
Normal file
13
lib/auth_client.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import {ADMIN_LIST, isName} from "@/lib/auth_list";
|
||||
import { JWT } from "next-auth/jwt";
|
||||
|
||||
export async function VerifiedUser(session: JWT |null) {
|
||||
const userId = session?.sub
|
||||
const name = session?.email || session?.name
|
||||
return !!(name && isName(name) && userId);
|
||||
}
|
||||
|
||||
export async function VerifiedAdminUser(session: JWT |null) {
|
||||
const name = session?.email || session?.name
|
||||
return !!(name && ADMIN_LIST.includes(name));
|
||||
}
|
||||
Reference in New Issue
Block a user