Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

fix(auth): move invalid credentials to password field (#8114)

Andrew Huang5ec20d181cb6
diff --git a/frontend/public/locales/en/translations.json b/frontend/public/locales/en/translations.json
index 36fe3b00f6..287d4c5877 100644
--- a/frontend/public/locales/en/translations.json
+++ b/frontend/public/locales/en/translations.json
@@ -135,7 +135,7 @@
"need-account": "Need an Infisical account?",
"create-account": "Create an account",
"forgot-password": "Forgot your password?",
- "error-login": "Wrong credentials.",
+ "error-login": "Incorrect email or password.",
"continue-with-google": "Continue with Google",
"continue-with-email": "Continue with Email",
"other-option": "Log in with another option"
diff --git a/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx b/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx
index 93c9bfbeb3..633b41b2d1 100644
--- a/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx
+++ b/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx
@@ -9,7 +9,6 @@ import { Eye, EyeOff } from "lucide-react";
import { z } from "zod";
import { AuthPagePanel } from "@app/components/auth/AuthPagePanel";
-import Error from "@app/components/basic/Error";
import { RegionSelect } from "@app/components/navigation/RegionSelect";
import { createNotification } from "@app/components/notifications";
import attemptLogin from "@app/components/utilities/attemptLogin";
@@ -22,6 +21,8 @@ import {
CardDescription,
CardHeader,
CardTitle,
+ Field,
+ FieldError,
FieldSeparator,
Input,
InputGroup,
@@ -95,6 +96,7 @@ export const InitialStep = ({ isAdmin }: Props) => {
}
});
const showDangerState = submitCount > 0;
+ const isLoginErrorVisible = !isLoading && loginError;
const redirectToSaml = (orgSlug: string) => {
const redirectUrl = `/api/v1/sso/redirect/saml2/organizations/${encodeURIComponent(orgSlug)}${
@@ -449,24 +451,30 @@ export const InitialStep = ({ isAdmin }: Props) => {
className="h-10"
isError={(showDangerState && Boolean(errors.email)) || loginError}
/>
- <InputGroup variant="outlined" className="h-10">
- <InputGroupInput
- {...register("password", { onChange: () => setLoginError(false) })}
- type={showPassword ? "text" : "password"}
- placeholder="••••••••"
- autoComplete="current-password"
- id="current-password"
- aria-invalid={(showDangerState && Boolean(errors.password)) || loginError}
- />
- <InputGroupAddon align="inline-end">
- <InputGroupButton
- onClick={() => setShowPassword((prev) => !prev)}
- aria-label={showPassword ? "Hide password" : "Show password"}
- >
- {showPassword ? <EyeOff /> : <Eye />}
- </InputGroupButton>
- </InputGroupAddon>
- </InputGroup>
+ <Field data-invalid={loginError}>
+ <InputGroup variant="outlined" className="h-10">
+ <InputGroupInput
+ {...register("password", { onChange: () => setLoginError(false) })}
+ type={showPassword ? "text" : "password"}
+ placeholder="••••••••"
+ autoComplete="current-password"
+ id="current-password"
+ aria-invalid={(showDangerState && Boolean(errors.password)) || loginError}
+ aria-describedby={isLoginErrorVisible ? "login-credentials-error" : undefined}
+ />
+ <InputGroupAddon align="inline-end">
+ <InputGroupButton
+ onClick={() => setShowPassword((prev) => !prev)}
+ aria-label={showPassword ? "Hide password" : "Show password"}
+ >
+ {showPassword ? <EyeOff /> : <Eye />}
+ </InputGroupButton>
+ </InputGroupAddon>
+ </InputGroup>
+ <FieldError id="login-credentials-error" isOpen={isLoginErrorVisible}>
+ {t("login.error-login") ?? ""}
+ </FieldError>
+ </Field>
{shouldShowCaptcha && envConfig.CAPTCHA_SITE_KEY && (
<div className="flex justify-center [&>div]:!w-full">
<HCaptcha
@@ -492,8 +500,6 @@ export const InitialStep = ({ isAdmin }: Props) => {
</Button>
</div>
)}
-
- {!isLoading && loginError && <Error text={t("login.error-login") ?? ""} />}
</CardContent>
</AuthPagePanel>
{config.allowSignUp &&