From a39a0aec4d17f409a192cd7d87eac24f1e39f786 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Mon, 6 May 2024 20:20:44 +0300 Subject: [PATCH] setup push email; enable local creds again --- .env | 1 + pages/api/auth/[...nextauth].ts | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.env b/.env index 229de8a..4390662 100644 --- a/.env +++ b/.env @@ -69,6 +69,7 @@ MAILTRAP_PASS=c7bc05f171c96c TELEGRAM_BOT=false TELEGRAM_BOT_TOKEN=7050075088:AAH6VRpNCyQd9x9sW6CLm6q0q4ibUgYBfnM +WEB_PUSH_EMAIL=mwitnessing@gmail.com NEXT_PUBLIC_WEB_PUSH_PUBLIC_KEY=BGxXJ0jdsQ4ihE7zp8mxrBO-QPSjeEtO9aCtPoMTuxc1VLW0OfRIt-DYinK9ekjTl2w-j0eQbeprIyBCpmmfciI WEB_PUSH_PRIVATE_KEY=VXHu2NgcyM4J4w3O4grkS_0yLwWHCvVKDJexyBjqgx0 # NEXT_PUBLIC_WEB_PUSH_PUBLIC_KEY= BBAbKJk4B6lYfNhe4sPc9bpLJXAcXwb2JEkQBlpyZG9DrKvVT1GdAi5d4a3VNgdJuYDlC43w20l5Aia13b748sE diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index cde6ebe..8cb4f4d 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -86,9 +86,9 @@ export const authOptions: NextAuthOptions = { // // Return null if user data could not be retrieved // return null const users = [ - { id: "1", name: "admin", email: "admin@example.com", password: "admin123", role: "ADMIN" }, - { id: "2", name: "krasi", email: "krasi@example.com", password: "krasi123", role: "ADMIN" }, - { id: "3", name: "popov", email: "popov@example.com", password: "popov123", role: "ADMIN" } + { id: "1", name: "admin", email: "admin@example.com", password: "admin123", role: "ADMIN", static: true }, + { id: "2", name: "krasi", email: "krasi@example.com", password: "krasi123", role: "ADMIN", static: true }, + { id: "3", name: "popov", email: "popov@example.com", password: "popov123", role: "ADMIN", static: true } ]; const user = users.find(user => @@ -174,6 +174,10 @@ export const authOptions: NextAuthOptions = { callbacks: { // https://codevoweb.com/implement-authentication-with-nextauth-in-nextjs-14/ async signIn({ user, account, profile }) { + if (account.provider === 'credentials' && user?.static) { + return true; + } + var prisma = common.getPrismaClient(); console.log("[nextauth] signIn:", account.provider, user.email)