nezha_dash/auth.ts
2024-10-21 02:19:30 +08:00

22 lines
516 B
TypeScript

import NextAuth from "next-auth";
import Credentials from "next-auth/providers/credentials";
import getEnv from "./lib/env-entry";
export const { handlers, signIn, signOut, auth } = NextAuth({
secret: "this_is_nezha_dash_web_secret",
providers: [
Credentials({
credentials: {
password: {},
},
authorize: async (credentials) => {
if (credentials.password === getEnv("SITE_PASSWORD")) {
return { id: "0" };
}
return null;
},
}),
],
});