fix(ui): simplify login and suppress pointer focus ring on locale select

This commit is contained in:
Codex
2026-09-13 15:57:57 +02:00
parent 7d826e46c0
commit 45db3a239b
7 changed files with 93 additions and 9 deletions
+9 -1
View File
@@ -7,6 +7,7 @@ import { LoginPage } from "./LoginPage";
import { clearAuthState, setAuthState } from "./authState";
import * as authApi from "../api/auth";
import { server } from "../test/msw";
import { setLocale } from "../i18n";
const localConfig = { mode: "local", localLogin: true, oidcLogin: false } as const;
const oidcConfig = { mode: "oidc", localLogin: false, oidcLogin: true } as const;
@@ -26,9 +27,16 @@ const authenticated = {
};
beforeEach(() => clearAuthState());
afterEach(() => clearAuthState());
afterEach(() => { clearAuthState(); setLocale("en"); });
describe("LoginPage", () => {
test.each(["en", "it"])("keeps only the main sign-in title in %s", locale => {
setLocale(locale);
render(<LoginPage config={localConfig} onAuthenticated={vi.fn()} />);
expect(screen.getByRole("heading", { name: locale === "it" ? "Accedi a ThothII" : "Sign in to ThothII" })).toBeInTheDocument();
expect(screen.queryByText(locale === "it" ? "Accesso a ThothII" : "ThothII access")).not.toBeInTheDocument();
expect(screen.queryByText(locale === "it" ? "Usa l’account della tua installazione per continuare." : "Use your installation account to continue.")).not.toBeInTheDocument();
});
test("shows an unchecked local Remember me control and clears the password after failure", async () => {
let submittedPassword = "";
server.use(http.post("/api/auth/local/login", async ({ request }) => {
+2 -7
View File
@@ -1,7 +1,7 @@
import { useI18n } from "../i18n";
import { useEffect, useRef, useState } from "react";
import type { FormEvent } from "react";
import { AlertTriangle, ArrowRight, Eye, EyeOff, LockKeyhole } from "lucide-react";
import { AlertTriangle, ArrowRight, Eye, EyeOff } from "lucide-react";
import { ApiError } from "../api/client";
import { beginOidcLogin, loginLocal } from "../api/auth";
import type { AuthenticatedUser, AuthPublicConfig } from "../api/types";
@@ -85,12 +85,7 @@ export function LoginPage({ config, onAuthenticated, onRetry }: LoginPageProps)
<section className="mx-auto w-full max-w-md rounded-2xl border border-border/80 bg-card p-6 shadow-md sm:p-8">
<div className="mb-7">
<div className="flex items-center gap-2 text-primary" aria-hidden="true">
<LockKeyhole className="size-4" />
<span className="thot-label text-primary">{t("ThothII access")}</span>
</div>
<h2 className="mt-3 font-heading text-3xl font-semibold tracking-tight">{t("Sign in to ThothII")}</h2>
<p className="mt-2 text-sm leading-6 text-muted-foreground">{t("Use your installation account to continue.")}</p>
<h2 className="font-heading text-3xl font-semibold tracking-tight">{t("Sign in to ThothII")}</h2>
</div>
{error && (