From 3ae6f73e9cb9eada007ffe8058e5b19b8fae538f Mon Sep 17 00:00:00 2001 From: James Singleton Date: Tue, 5 May 2026 14:18:57 -0500 Subject: [PATCH 1/3] Add error message for invalid password --- apps/web/app/routes/auth/login.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/web/app/routes/auth/login.tsx b/apps/web/app/routes/auth/login.tsx index c4c250f65..7c4e49dcc 100644 --- a/apps/web/app/routes/auth/login.tsx +++ b/apps/web/app/routes/auth/login.tsx @@ -1,11 +1,13 @@ "use client"; +import { useState } from "react"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; import { SiGoogle, SiOkta } from "@icons-pack/react-simple-icons"; import { authClient } from "~/api/auth-client"; import { useAuthConfig } from "~/api/auth-config"; +import { Alert, AlertDescription } from "~/components/ui/alert"; import { Button } from "~/components/ui/button"; import { Card, @@ -49,6 +51,7 @@ const signInEmailPasswordSchema = z.object({ }); function LoginEmailPassword() { + const [errorMessage, setErrorMessage] = useState(null); const form = useForm>({ resolver: zodResolver(signInEmailPasswordSchema), defaultValues: { @@ -57,17 +60,24 @@ function LoginEmailPassword() { }, }); - const onSubmit = (data: z.infer) => { - void authClient.signIn.email({ + const onSubmit = async (data: z.infer) => { + setErrorMessage(null); + const { error } = await authClient.signIn.email({ ...data, rememberMe: true, callbackURL: "/workspaces", }); + if (error) setErrorMessage(error.message ?? "Failed to sign in"); }; return (
+ {errorMessage && ( + + {errorMessage} + + )} Date: Tue, 5 May 2026 14:30:37 -0500 Subject: [PATCH 2/3] Switch to FC --- apps/web/app/routes/auth/login.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/web/app/routes/auth/login.tsx b/apps/web/app/routes/auth/login.tsx index 7c4e49dcc..69fdfd0e5 100644 --- a/apps/web/app/routes/auth/login.tsx +++ b/apps/web/app/routes/auth/login.tsx @@ -1,6 +1,7 @@ "use client"; import { useState } from "react"; +import type { FC } from "react"; import { zodResolver } from "@hookform/resolvers/zod"; import { useForm } from "react-hook-form"; import { z } from "zod"; @@ -50,7 +51,7 @@ const signInEmailPasswordSchema = z.object({ password: z.string(), }); -function LoginEmailPassword() { +const LoginEmailPassword: FC = () => { const [errorMessage, setErrorMessage] = useState(null); const form = useForm>({ resolver: zodResolver(signInEmailPasswordSchema), @@ -121,7 +122,7 @@ function LoginEmailPassword() { ); -} +}; export default function Login() { const authConfig = useAuthConfig(); From 20238f8fe76d46a4e342c3cc683407929117b1ca Mon Sep 17 00:00:00 2001 From: James Singleton Date: Tue, 5 May 2026 14:34:07 -0500 Subject: [PATCH 3/3] Restrict error messages displayed --- apps/web/app/routes/auth/login.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/web/app/routes/auth/login.tsx b/apps/web/app/routes/auth/login.tsx index 69fdfd0e5..70d1511b0 100644 --- a/apps/web/app/routes/auth/login.tsx +++ b/apps/web/app/routes/auth/login.tsx @@ -68,7 +68,12 @@ const LoginEmailPassword: FC = () => { rememberMe: true, callbackURL: "/workspaces", }); - if (error) setErrorMessage(error.message ?? "Failed to sign in"); + if (error) + setErrorMessage( + error.code === "INVALID_EMAIL_OR_PASSWORD" && error.message + ? error.message + : "Failed to sign in", + ); }; return (