Hash Password

This commit is contained in:
headlesdev 2025-05-17 14:57:58 +02:00
parent e9fe5bb22a
commit 03db0eabad
4 changed files with 13 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import { NextRequest, NextResponse } from "next/server"; import { NextRequest, NextResponse } from "next/server";
import bcrypt from 'bcryptjs';
import prisma from "@/app/prisma"; import prisma from "@/app/prisma";
interface Body { interface Body {
@ -21,7 +22,7 @@ export async function POST(request: NextRequest) {
username: body.username, username: body.username,
name: body.name, name: body.name,
email: body.email, email: body.email,
password: body.password, password: await bcrypt.hash(body.password, 10),
}, },
}); });

View File

10
package-lock.json generated
View File

@ -9,6 +9,7 @@
"version": "0.1.0", "version": "0.1.0",
"dependencies": { "dependencies": {
"@prisma/client": "^6.8.2", "@prisma/client": "^6.8.2",
"bcryptjs": "^3.0.2",
"daisyui": "^5.0.35", "daisyui": "^5.0.35",
"lucide-react": "^0.511.0", "lucide-react": "^0.511.0",
"next": "15.3.2", "next": "15.3.2",
@ -1042,6 +1043,15 @@
"@types/react": "^19.0.0" "@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": { "node_modules/busboy": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz", "resolved": "https://registry.npmjs.org/busboy/-/busboy-1.6.0.tgz",

View File

@ -10,6 +10,7 @@
}, },
"dependencies": { "dependencies": {
"@prisma/client": "^6.8.2", "@prisma/client": "^6.8.2",
"bcryptjs": "^3.0.2",
"daisyui": "^5.0.35", "daisyui": "^5.0.35",
"lucide-react": "^0.511.0", "lucide-react": "^0.511.0",
"next": "15.3.2", "next": "15.3.2",