From 919016cf27fc7928903e5f2bd62ccb845c83b1da Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Tue, 18 Mar 2025 23:24:36 +0800 Subject: [PATCH] fix(auth): update error message for sign-in and sign-up functions --- src/app/actions/auth.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/app/actions/auth.ts b/src/app/actions/auth.ts index 5181a89..f304a29 100644 --- a/src/app/actions/auth.ts +++ b/src/app/actions/auth.ts @@ -4,7 +4,6 @@ import bcrypt from "bcrypt"; import prisma from "@/lib/prisma"; import { signIn } from "@/lib/auth"; import { authSchema } from "@/lib/zod"; -import { Prisma } from "@prisma/client"; import { CredentialsSignInFormValues } from "@/components/credentials-sign-in-form"; import { CredentialsSignUpFormValues } from "@/components/credentials-sign-up-form"; @@ -19,7 +18,7 @@ export async function signInWithCredentials(formData: CredentialsSignInFormValue return { success: true }; } catch (error) { if (error instanceof Error) { - return { error: error.message }; + return { error: "Invalid credentials" }; } return { error: "Failed to sign in. Please try again." }; } @@ -55,11 +54,6 @@ export async function signUpWithCredentials(formData: CredentialsSignUpFormValue return { success: true }; } catch (error) { - if (error instanceof Prisma.PrismaClientKnownRequestError) { - if (error.code === "P2002") { - return { error: "Email already registered" }; - } - } if (error instanceof Error) { return { error: error.message }; }