mirror of
https://github.com/mudabbir-ahmad/peworkshop.git
synced 2026-10-08 03:50:21 +00:00
frick my life
This commit is contained in:
1 parent
4ed0480d08
commit
01f9d00f6f
5 files changed
+49
-25
No files matched your search
@@ -3,6 +3,7 @@ import CredentialsProvider from "next-auth/providers/credentials";
|
|||||||
import { validateCredentials } from "@/actions/auth";
|
import { validateCredentials } from "@/actions/auth";
|
||||||
|
|
||||||
export const authOptions = {
|
export const authOptions = {
|
||||||
|
debug: process.env.NODE_ENV === "development",
|
||||||
providers: [
|
providers: [
|
||||||
CredentialsProvider({
|
CredentialsProvider({
|
||||||
id: "credentials",
|
id: "credentials",
|
||||||
@@ -12,21 +13,19 @@ export const authOptions = {
|
|||||||
password: { label: "Password", type: "password" },
|
password: { label: "Password", type: "password" },
|
||||||
},
|
},
|
||||||
async authorize(credentials) {
|
async authorize(credentials) {
|
||||||
try {
|
if (!credentials?.username || !credentials?.password) return null;
|
||||||
if (!credentials?.username || !credentials?.password) {
|
const user = await validateCredentials(
|
||||||
return null;
|
credentials.username,
|
||||||
}
|
credentials.password
|
||||||
|
);
|
||||||
const user = await validateCredentials(
|
return user
|
||||||
credentials.username,
|
? {
|
||||||
credentials.password
|
id: user.id,
|
||||||
);
|
username: user.username,
|
||||||
|
role: user.role,
|
||||||
return user;
|
teamId: user.teamId,
|
||||||
} catch (error) {
|
}
|
||||||
console.error("Auth error:", error);
|
: null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
@@ -51,12 +50,8 @@ export const authOptions = {
|
|||||||
return session;
|
return session;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
pages: {
|
pages: { signIn: "/login" },
|
||||||
signIn: "/login",
|
session: { strategy: "jwt", maxAge: 30 * 24 * 60 * 60 },
|
||||||
},
|
|
||||||
session: {
|
|
||||||
strategy: "jwt",
|
|
||||||
},
|
|
||||||
secret: process.env.NEXTAUTH_SECRET,
|
secret: process.env.NEXTAUTH_SECRET,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ import { NextAuthProvider } from "./providers";
|
|||||||
export default function RootLayout({ children }) {
|
export default function RootLayout({ children }) {
|
||||||
return (
|
return (
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<body>
|
<body suppressHydrationWarning={true}>
|
||||||
<NextAuthProvider>{children}</NextAuthProvider>
|
<NextAuthProvider>{children}</NextAuthProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
'use client';
|
"use client";
|
||||||
|
|
||||||
import { SessionProvider } from "next-auth/react";
|
import { SessionProvider } from "next-auth/react";
|
||||||
|
|
||||||
export function NextAuthProvider({ children }) {
|
export function NextAuthProvider({ children }) {
|
||||||
return <SessionProvider>{children}</SessionProvider>;
|
return <SessionProvider>{children}</SessionProvider>;
|
||||||
}
|
}
|
||||||
Binary file not shown.
+29
@@ -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: <SomeEnabledInspectionId>
|
||||||
|
|
||||||
|
#Disable inspections
|
||||||
|
#exclude:
|
||||||
|
# - name: <SomeDisabledInspectionId>
|
||||||
|
# paths:
|
||||||
|
# - <path/where/not/run/inspection>
|
||||||
|
|
||||||
|
#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> #(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
|
||||||
Reference in new issue
Block a user