mirror of
https://github.com/cfngc4594/monaco-editor-lsp-next.git
synced 2025-05-18 15:26:36 +00:00
fix(auth): update error message for sign-in and sign-up functions
This commit is contained in:
parent
0e16b9ff6c
commit
919016cf27
@ -4,7 +4,6 @@ import bcrypt from "bcrypt";
|
|||||||
import prisma from "@/lib/prisma";
|
import prisma from "@/lib/prisma";
|
||||||
import { signIn } from "@/lib/auth";
|
import { signIn } from "@/lib/auth";
|
||||||
import { authSchema } from "@/lib/zod";
|
import { authSchema } from "@/lib/zod";
|
||||||
import { Prisma } from "@prisma/client";
|
|
||||||
import { CredentialsSignInFormValues } from "@/components/credentials-sign-in-form";
|
import { CredentialsSignInFormValues } from "@/components/credentials-sign-in-form";
|
||||||
import { CredentialsSignUpFormValues } from "@/components/credentials-sign-up-form";
|
import { CredentialsSignUpFormValues } from "@/components/credentials-sign-up-form";
|
||||||
|
|
||||||
@ -19,7 +18,7 @@ export async function signInWithCredentials(formData: CredentialsSignInFormValue
|
|||||||
return { success: true };
|
return { success: true };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
return { error: error.message };
|
return { error: "Invalid credentials" };
|
||||||
}
|
}
|
||||||
return { error: "Failed to sign in. Please try again." };
|
return { error: "Failed to sign in. Please try again." };
|
||||||
}
|
}
|
||||||
@ -55,11 +54,6 @@ export async function signUpWithCredentials(formData: CredentialsSignUpFormValue
|
|||||||
|
|
||||||
return { success: true };
|
return { success: true };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error instanceof Prisma.PrismaClientKnownRequestError) {
|
|
||||||
if (error.code === "P2002") {
|
|
||||||
return { error: "Email already registered" };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (error instanceof Error) {
|
if (error instanceof Error) {
|
||||||
return { error: error.message };
|
return { error: error.message };
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user