From 028cffc0334b06457e514d373be9572e229f8a73 Mon Sep 17 00:00:00 2001 From: mudabbir-ahmad Date: Wed, 12 Mar 2025 02:12:47 +0000 Subject: [PATCH] fixed a bit --- app/api/auth/[...nextauth]/route.js | 37 ++++++++++++---------------- app/layout.js | 2 +- app/providers.js | 6 ++--- database.sqlite | Bin 24576 -> 24576 bytes qodana.yaml | 29 ++++++++++++++++++++++ 5 files changed, 49 insertions(+), 25 deletions(-) create mode 100644 qodana.yaml diff --git a/app/api/auth/[...nextauth]/route.js b/app/api/auth/[...nextauth]/route.js index aaeb3c0..1d02ad8 100644 --- a/app/api/auth/[...nextauth]/route.js +++ b/app/api/auth/[...nextauth]/route.js @@ -3,6 +3,7 @@ import CredentialsProvider from "next-auth/providers/credentials"; import { validateCredentials } from "@/actions/auth"; export const authOptions = { + debug: process.env.NODE_ENV === "development", providers: [ CredentialsProvider({ id: "credentials", @@ -12,21 +13,19 @@ export const authOptions = { password: { label: "Password", type: "password" }, }, async authorize(credentials) { - try { - if (!credentials?.username || !credentials?.password) { - return null; - } - - const user = await validateCredentials( - credentials.username, - credentials.password - ); - - return user; - } catch (error) { - console.error("Auth error:", error); - return null; - } + if (!credentials?.username || !credentials?.password) return null; + const user = await validateCredentials( + credentials.username, + credentials.password + ); + return user + ? { + id: user.id, + username: user.username, + role: user.role, + teamId: user.teamId, + } + : null; }, }), ], @@ -51,12 +50,8 @@ export const authOptions = { return session; }, }, - pages: { - signIn: "/login", - }, - session: { - strategy: "jwt", - }, + pages: { signIn: "/login" }, + session: { strategy: "jwt", maxAge: 30 * 24 * 60 * 60 }, secret: process.env.NEXTAUTH_SECRET, }; diff --git a/app/layout.js b/app/layout.js index 7eecd5b..66d1a68 100644 --- a/app/layout.js +++ b/app/layout.js @@ -4,7 +4,7 @@ import { NextAuthProvider } from "./providers"; export default function RootLayout({ children }) { return ( - + {children} diff --git a/app/providers.js b/app/providers.js index 8662db2..5f4a879 100644 --- a/app/providers.js +++ b/app/providers.js @@ -1,7 +1,7 @@ -'use client'; +"use client"; import { SessionProvider } from "next-auth/react"; export function NextAuthProvider({ children }) { - return {children}; -} \ No newline at end of file + return {children}; +} diff --git a/database.sqlite b/database.sqlite index a1ad0f13667221c4b61758ba8510e118487a839f..19ecf54df4cd37cc9b37bf2b611c32a152b6895d 100644 GIT binary patch delta 182 zcmZoTz}Rqrae_1>^F$eEM&^wPOZeFs`R6n6&)+O4FqJ<$o{@t=w2@Vm!8j>D$wb8{ zNyX4W#WXLh(%jKW&%(zt#Ui*MEvPcmCBxsTD$>xntR&bd*SpBi!d1`LT))a9IK42~ z-zDGGFub%lwaCc8$W+(BSl7@L-Nfsy|Q1OE@8h41)<*qKE+L00jC a#lJD|e*=oY;pgIDWESTHnNhq*Kmh=nmoO6m delta 30 mcmZoTz}Rqrae_1>(?l6(My8DkOZYdlIQ)@c+}p+6nFe diff --git a/qodana.yaml b/qodana.yaml new file mode 100644 index 0000000..714e5ea --- /dev/null +++ b/qodana.yaml @@ -0,0 +1,29 @@ +#-------------------------------------------------------------------------------# +# Qodana analysis is configured by qodana.yaml file # +# https://www.jetbrains.com/help/qodana/qodana-yaml.html # +#-------------------------------------------------------------------------------# +version: "1.0" + +#Specify inspection profile for code analysis +profile: + name: qodana.starter + +#Enable inspections +#include: +# - name: + +#Disable inspections +#exclude: +# - name: +# paths: +# - + +#Execute shell command before Qodana execution (Applied in CI/CD pipeline) +#bootstrap: sh ./prepare-qodana.sh + +#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline) +#plugins: +# - id: #(plugin id can be found at https://plugins.jetbrains.com) + +#Specify Qodana linter for analysis (Applied in CI/CD pipeline) +linter: jetbrains/qodana-js:2024.3