diff --git a/app/api/user/create/route.ts b/app/api/user/create/route.ts index 93e3f1e..0a3487b 100644 --- a/app/api/user/create/route.ts +++ b/app/api/user/create/route.ts @@ -1,4 +1,5 @@ import { NextRequest, NextResponse } from "next/server"; +import bcrypt from 'bcryptjs'; import prisma from "@/app/prisma"; interface Body { @@ -21,7 +22,7 @@ export async function POST(request: NextRequest) { username: body.username, name: body.name, email: body.email, - password: body.password, + password: await bcrypt.hash(body.password, 10), }, }); diff --git a/app/api/user/login.ts/route.ts b/app/api/user/login.ts/route.ts new file mode 100644 index 0000000..e69de29 diff --git a/package-lock.json b/package-lock.json index 54f4195..2f962f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "0.1.0", "dependencies": { "@prisma/client": "^6.8.2", + "bcryptjs": "^3.0.2", "daisyui": "^5.0.35", "lucide-react": "^0.511.0", "next": "15.3.2", @@ -1042,6 +1043,15 @@ "@types/react": "^19.0.0" } }, + "node_modules/bcryptjs": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-3.0.2.tgz", + "integrity": "sha512-k38b3XOZKv60C4E2hVsXTolJWfkGRMbILBIe2IBITXciy5bOsTKot5kDrf3ZfufQtQOUN5mXceUEpU1rTl9Uog==", + "license": "BSD-3-Clause", + "bin": { + "bcrypt": "bin/bcrypt" + } + }, "node_modules/busboy": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", diff --git a/package.json b/package.json index 11f16a2..75d340e 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ }, "dependencies": { "@prisma/client": "^6.8.2", + "bcryptjs": "^3.0.2", "daisyui": "^5.0.35", "lucide-react": "^0.511.0", "next": "15.3.2",