mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
feat: enhance auth secret generation with CryptoJS MD5 hashing
This commit is contained in:
parent
e90914b320
commit
4bbda14bf0
3
auth.ts
3
auth.ts
@ -1,9 +1,10 @@
|
||||
import getEnv from "@/lib/env-entry"
|
||||
import NextAuth from "next-auth"
|
||||
import CredentialsProvider from "next-auth/providers/credentials"
|
||||
import CryptoJS from 'crypto-js'
|
||||
|
||||
export const { handlers, signIn, signOut, auth } = NextAuth({
|
||||
secret: process.env.AUTH_SECRET ?? "this_is_nezha_dash_web_secret",
|
||||
secret: process.env.AUTH_SECRET ?? CryptoJS.MD5(`this_is_nezha_dash_web_secret_${getEnv("SitePassword")}`).toString(),
|
||||
trustHost: (process.env.AUTH_TRUST_HOST as boolean | undefined) ?? true,
|
||||
providers: [
|
||||
CredentialsProvider({
|
||||
|
@ -27,6 +27,7 @@
|
||||
"@radix-ui/react-switch": "^1.1.2",
|
||||
"@radix-ui/react-tooltip": "^1.1.7",
|
||||
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/d3-geo": "^3.1.0",
|
||||
"@types/luxon": "^3.4.2",
|
||||
"babel-plugin-react-compiler": "^19.0.0-beta-e552027-20250112",
|
||||
@ -35,6 +36,7 @@
|
||||
"clsx": "^2.1.1",
|
||||
"cmdk": "^1.0.4",
|
||||
"country-flag-icons": "^1.5.14",
|
||||
"crypto-js": "^4.2.0",
|
||||
"d3-geo": "^3.1.1",
|
||||
"d3-selection": "^3.0.0",
|
||||
"flag-icons": "^7.3.2",
|
||||
|
Loading…
Reference in New Issue
Block a user