Configure Better Auth to use bcrypt for password hashing
This commit is contained in:
@@ -2,6 +2,7 @@ import { betterAuth } from "better-auth";
|
||||
import { prismaAdapter } from "better-auth/adapters/prisma";
|
||||
import { admin } from "better-auth/plugins";
|
||||
import { prisma } from "./prisma";
|
||||
import bcrypt from "bcryptjs";
|
||||
|
||||
export const auth = betterAuth({
|
||||
database: prismaAdapter(prisma, {
|
||||
@@ -10,6 +11,10 @@ export const auth = betterAuth({
|
||||
emailAndPassword: {
|
||||
enabled: true,
|
||||
requireEmailVerification: true,
|
||||
password: {
|
||||
hash: (password) => bcrypt.hash(password, 10),
|
||||
verify: ({ hash, password }) => bcrypt.compare(password, hash),
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
admin({
|
||||
|
||||
Reference in New Issue
Block a user