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 a1ad0f1..19ecf54 100644 Binary files a/database.sqlite and b/database.sqlite differ 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