fix(auth): say a refused sign-in in the sign-in page's own words

The sign-in refusals carry only their status's generic code, so once the
sign-in page read codes, a wrong password, a wrong second-factor code
and a refused security key all said "Your session has ended", and a
lockout said "too many requests just now".

localizedSignInError reads a generic 401 as the step's own failure and a
generic 429 as "Too many attempts. Wait a few minutes and try again.";
a code the step names itself keeps its sentence. The password, passkey,
code and security-key steps use it. The rate-limit sentence moves from
auth.claim to auth.signInRateLimited, since the claim page and the
sign-in page now share it, and the Korean one takes the polite form the
rest of the catalogue uses.
This commit is contained in:
Marc-André Bombeck committed 2026-11-12 13:54:34 +01:00
1 parent 367ba65bf6
commit 1dde3034c6
16 files changed
+95 -32

No files matched your search

+2 -2
View File
@@ -229,7 +229,7 @@ export function ClaimProfile({
title={t("auth.claim.title")}
description={t(
previewStatus === 429
? "auth.claim.errorRateLimit"
? "auth.signInRateLimited"
: "auth.claim.errorFailed",
)}
/>
@@ -548,6 +548,6 @@ export function claimErrorKey(err: unknown): string {
: "auth.claim.errorTaken";
}
if (err.status === 403) return "auth.claim.oidcOnly";
if (err.status === 429) return "auth.claim.errorRateLimit";
if (err.status === 429) return "auth.signInRateLimited";
return "auth.claim.errorFailed";
}
+3 -3
View File
@@ -9,7 +9,7 @@ import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { useTranslations } from "@/lib/i18n/context";
import { ApiError, apiPost } from "@/lib/api/api-fetch";
import { localizedApiError } from "@/lib/api/localized-error";
import { localizedSignInError } from "@/lib/api/localized-error";
import { currentClientTransport } from "@/lib/auth/client-transport";
/** The server's refusal for a page whose sign-in cookie cannot stick. */
@@ -74,7 +74,7 @@ export function MfaLoginStep({
err instanceof ApiError &&
err.meta?.errorCode === INSECURE_TRANSPORT_CODE
? t("auth.insecureTransport.title")
: localizedApiError(err, t, "auth.mfa.verifyFailed"),
: localizedSignInError(err, t, "auth.mfa.verifyFailed"),
);
} finally {
setLoading(false);
@@ -101,7 +101,7 @@ export function MfaLoginStep({
onSuccess();
} catch (err) {
if (err instanceof ApiError) {
setError(localizedApiError(err, t, "auth.mfa.verifyFailed"));
setError(localizedSignInError(err, t, "auth.mfa.verifyFailed"));
} else {
const { key, params } = describePasskeyError(err);
setError(t(key, params));
@@ -52,7 +52,7 @@ describe("claimErrorKey", () => {
"auth.claim.signedInTitle",
],
[new ApiError("x", 403, {}), "auth.claim.oidcOnly"],
[new ApiError("x", 429, {}), "auth.claim.errorRateLimit"],
[new ApiError("x", 429, {}), "auth.signInRateLimited"],
[new ApiError("x", 500, {}), "auth.claim.errorFailed"],
[new Error("offline"), "auth.claim.errorOffline"],
])("maps %o", (err, key) => {