From cd50e73fc94e1e81c348a8f72e773cd305abed2a Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Fri, 14 Mar 2025 17:15:38 +0800 Subject: [PATCH] refactor(auth): extract saltRounds constant --- src/app/actions/auth.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/app/actions/auth.ts b/src/app/actions/auth.ts index cf58c9a..032d9f4 100644 --- a/src/app/actions/auth.ts +++ b/src/app/actions/auth.ts @@ -6,13 +6,15 @@ import { signIn } from "@/lib/auth"; import { authSchema } from "@/lib/zod"; import { redirect } from "next/navigation"; +const saltRounds = 10; + export async function signInWithCredentials(formData: { email: string; password: string }) { await signIn("credentials", formData); } export async function signUpWithCredentials(formData: { email: string; password: string }) { const validatedData = await authSchema.parseAsync(formData); - const saltRounds = 10; + const pwHash = await bcrypt.hash(validatedData.password, saltRounds); await prisma.user.create({