From e9d72005a313a87aeb0ab3dadb81ad686a710a52 Mon Sep 17 00:00:00 2001 From: Stephen Werronen Date: Tue, 18 Feb 2025 13:41:25 -0800 Subject: [PATCH] Improve field errors for failed sign in attempts Signed-off-by: Stephen Werronen --- web-app/app/actions-auth.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/web-app/app/actions-auth.ts b/web-app/app/actions-auth.ts index e94c248..23fec78 100644 --- a/web-app/app/actions-auth.ts +++ b/web-app/app/actions-auth.ts @@ -27,7 +27,10 @@ export async function loginWithEmailPassword( return { lastInvocationStatus: "error", error: { - fieldErrors: { password: "Unknown user or incorrect password" }, + fieldErrors: { + password: "Unknown user or incorrect password", + email: "Unknown user or incorrect password", + }, }, }; } else { @@ -53,7 +56,14 @@ export async function loginWithMagicLink( ? { lastInvocationStatus: "success" } : { lastInvocationStatus: "error", - error: { rootError: JSON.stringify(error) }, + error: + error.code === "otp_disabled" + ? { + fieldErrors: { + email: "Unknown user", + }, + } + : { rootError: JSON.stringify(error) }, }; }