CHORE(merge): merge from develop
Some checks failed
Build Docker Image / build-and-push (push) Has been cancelled
CI / lint-and-build (push) Has been cancelled

- Initial setup and all features from develop branch
- Includes: auth, deploy, docker, style fixes
- K3S deployment configuration
This commit is contained in:
2026-01-06 17:29:16 +09:00
parent b4ce36ba3b
commit f78454c2a1
159 changed files with 18365 additions and 774 deletions

73
nextjs/lib/auth.ts Normal file
View File

@@ -0,0 +1,73 @@
import NextAuth from "next-auth";
import Credentials from "next-auth/providers/credentials";
import { compare } from "bcryptjs";
import { prisma } from "@/lib/prisma";
export const { handlers, signIn, signOut, auth } = NextAuth({
trustHost: true,
secret: process.env.AUTH_SECRET || process.env.JWT_SECRET,
providers: [
Credentials({
name: "Credentials",
credentials: {
userId: { label: "아이디", type: "text" },
userPassword: { label: "비밀번호", type: "password" },
},
async authorize(credentials) {
if (!credentials?.userId || !credentials?.userPassword) {
return null;
}
const user = await prisma.user.findUnique({
where: { userId: credentials.userId as string },
});
if (!user) {
return null;
}
const isPasswordCorrect = await compare(
credentials.userPassword as string,
user.userPassword
);
if (!isPasswordCorrect) {
return null;
}
return {
id: user.id.toString(),
userId: user.userId,
name: user.userName,
email: user.userPhone,
};
},
}),
],
session: {
strategy: "jwt",
maxAge: 3 * 24 * 60 * 60, // 3일
},
callbacks: {
async jwt({ token, user }) {
if (user) {
token.id = user.id;
token.userId = user.userId;
token.name = user.name;
}
return token;
},
async session({ session, token }) {
if (token && session.user) {
session.user.id = token.id as string;
session.user.userId = token.userId as string;
session.user.name = token.name as string;
}
return session;
},
},
pages: {
signIn: "/login",
},
});