mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-11-17 22:43:42 +08:00
初次优化认证
This commit is contained in:
12
lib/auth.ts
12
lib/auth.ts
@@ -2,10 +2,10 @@ import {getServerSession, type NextAuthOptions, Theme} from "next-auth";
|
||||
import GitHubProvider from "next-auth/providers/github";
|
||||
import EmailProvider from "next-auth/providers/email";
|
||||
import CredentialsProvider from "next-auth/providers/credentials";
|
||||
import { PrismaAdapter } from "@next-auth/prisma-adapter";
|
||||
import {PrismaAdapter} from "@next-auth/prisma-adapter";
|
||||
import prisma from "@/lib/prisma";
|
||||
import { isEmail, isName } from "@/lib/auth_list";
|
||||
import { createTransport } from "nodemailer";
|
||||
import {isEmail, isName} from "@/lib/auth_list";
|
||||
import {createTransport} from "nodemailer";
|
||||
|
||||
const SECURE_COOKIES:boolean = !!process.env.SECURE_COOKIES;
|
||||
|
||||
@@ -157,6 +157,12 @@ export function getSession() {
|
||||
} | null>;
|
||||
}
|
||||
|
||||
export async function getSessionName() {
|
||||
const session = await getSession();
|
||||
// console.log('in........',)
|
||||
return session?.user?.email || session?.user?.name
|
||||
}
|
||||
|
||||
// export function withSiteAuth(action: any) {
|
||||
// return async (
|
||||
// formData: FormData | null,
|
||||
|
||||
Reference in New Issue
Block a user