mirror of
https://github.com/ChatGPTNextWeb/ChatGPT-Next-Web.git
synced 2025-10-01 15:46:39 +08:00
commit
4c89e12b4c
@ -27,13 +27,10 @@ async function handle(
|
|||||||
const get_access_token = await getAccessToken();
|
const get_access_token = await getAccessToken();
|
||||||
|
|
||||||
if (!get_access_token.ok) {
|
if (!get_access_token.ok) {
|
||||||
return NextResponse.json(
|
return NextResponse.json({ error: "获取access_token失败" }, {
|
||||||
{ error: "获取access_token失败" },
|
|
||||||
{
|
|
||||||
status: get_access_token.status,
|
status: get_access_token.status,
|
||||||
statusText: get_access_token.statusText,
|
statusText: get_access_token.statusText,
|
||||||
},
|
} as any);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
const access_token = await get_access_token.text();
|
const access_token = await get_access_token.text();
|
||||||
|
|
||||||
@ -42,3 +39,5 @@ async function handle(
|
|||||||
|
|
||||||
export const GET = handle;
|
export const GET = handle;
|
||||||
// export const POST = handle;
|
// export const POST = handle;
|
||||||
|
|
||||||
|
export const runtime = "edge";
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import LoginByGithub from "./loginByGithub";
|
import LoginByGithub from "./loginByGithub";
|
||||||
import LoginByGoogle from "./loginByGoogle";
|
import LoginByGoogle from "./loginByGoogle";
|
||||||
import UserLoginCore from "./user-login-core";
|
import UserLoginCore from "./user-login-core";
|
||||||
|
import { Suspense } from "react";
|
||||||
|
|
||||||
export default function LoginPage() {
|
export default function LoginPage() {
|
||||||
return (
|
return (
|
||||||
@ -14,7 +15,9 @@ export default function LoginPage() {
|
|||||||
{/*>*/}
|
{/*>*/}
|
||||||
{/* */}
|
{/* */}
|
||||||
{/*</Suspense>*/}
|
{/*</Suspense>*/}
|
||||||
|
<Suspense>
|
||||||
<UserLoginCore />
|
<UserLoginCore />
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
<div className="mx-auto mt-4 w-11/12 max-w-xs sm:w-full inline-flex items-center justify-center">
|
<div className="mx-auto mt-4 w-11/12 max-w-xs sm:w-full inline-flex items-center justify-center">
|
||||||
{/*<Suspense*/}
|
{/*<Suspense*/}
|
||||||
|
@ -25,8 +25,8 @@ export const authOptions: NextAuthOptions = {
|
|||||||
secret: process.env.NEXTAUTH_SECRET,
|
secret: process.env.NEXTAUTH_SECRET,
|
||||||
providers: [
|
providers: [
|
||||||
Github({
|
Github({
|
||||||
clientId: process.env.AUTH_GITHUB_ID as string,
|
clientId: process.env.AUTH_GITHUB_ID ?? "",
|
||||||
clientSecret: process.env.AUTH_GITHUB_SECRET as string,
|
clientSecret: process.env.AUTH_GITHUB_SECRET ?? "",
|
||||||
profile(profile) {
|
profile(profile) {
|
||||||
return {
|
return {
|
||||||
id: profile.id.toString(),
|
id: profile.id.toString(),
|
||||||
@ -129,8 +129,8 @@ export const authOptions: NextAuthOptions = {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
Google({
|
Google({
|
||||||
clientId: process.env.GOOGLE_CLIENT_ID,
|
clientId: process.env.GOOGLE_CLIENT_ID ?? "",
|
||||||
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
|
clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? "",
|
||||||
allowDangerousEmailAccountLinking: true,
|
allowDangerousEmailAccountLinking: true,
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
1
lib/types/next-auth.d.ts
vendored
1
lib/types/next-auth.d.ts
vendored
@ -25,6 +25,7 @@ declare module "next-auth" {
|
|||||||
gh_username?: string;
|
gh_username?: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
isAdmin?: boolean;
|
isAdmin?: boolean;
|
||||||
|
allowToLogin?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user