From e15211587199511c5ccad7939c378fbf551d114b Mon Sep 17 00:00:00 2001 From: John Coffey Date: Thu, 19 Nov 2026 10:33:48 -0700 Subject: [PATCH] Sign-in: hide the inbuxa wordmark under a custom logo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With a logo set on the mail server, the sign-in card showed it and then the inbuxa wordmark right under it: two logos crowding each other (#122). Under a custom logo now: - the wordmark is gone; the heading stays for screen readers (sr-only); - the footer credits inbuxa as "Powered by inbuxa Webmail v…", with the name linking to inbuxa.org, and the AGPL-3.0 source link on the line below. A bare "inbuxa.org" under somebody else's logo read as a stray URL. While the logo is still being asked for, the wordmark is held unseen like the built-in image, so it doesn't flash up and vanish. A name the administrator set (APP_NAME) still shows: they chose it. Without a custom logo the page is unchanged, apart from "inbuxa Webmail" now capitalised as the component name. The new string is added to all ten catalogs (AI-written, like the rest of each catalog). Tests: a component test for the default, custom and loading states. Fixes #122 --- web/src/locales/de.ts | 1 + web/src/locales/es.ts | 1 + web/src/locales/fr.ts | 1 + web/src/locales/ja.ts | 1 + web/src/locales/nl.ts | 1 + web/src/locales/pt-BR.ts | 1 + web/src/locales/ru.ts | 1 + web/src/locales/tr.ts | 1 + web/src/locales/uk.ts | 1 + web/src/locales/zh-Hans.ts | 1 + web/src/views/Login.tsx | 62 ++++++++++++--- .../__tests__/login-custom-logo.test.tsx | 78 +++++++++++++++++++ 12 files changed, 139 insertions(+), 11 deletions(-) create mode 100644 web/src/views/__tests__/login-custom-logo.test.tsx diff --git a/web/src/locales/de.ts b/web/src/locales/de.ts index 98a0c71..df1a560 100644 --- a/web/src/locales/de.ts +++ b/web/src/locales/de.ts @@ -861,6 +861,7 @@ export const catalog: Catalog = { "connected": "verbunden", "reconnecting…": "Verbindung wird wiederhergestellt…", "AGPL-3.0 source": "AGPL-3.0-Quellcode", + "Powered by {product} v{version}": "Betrieben mit {product} v{version}", // ── Identities, templates, filters ───────────────────────────────── "Identities & signatures": "Identitäten & Signaturen", diff --git a/web/src/locales/es.ts b/web/src/locales/es.ts index 8d54902..93abbd7 100644 --- a/web/src/locales/es.ts +++ b/web/src/locales/es.ts @@ -858,6 +858,7 @@ export const catalog: Catalog = { "connected": "conectado", "reconnecting…": "reconectando…", "AGPL-3.0 source": "Código fuente AGPL-3.0", + "Powered by {product} v{version}": "Con la tecnología de {product} v{version}", // ── Identities, templates, filters ───────────────────────────────── "Identities & signatures": "Identidades y firmas", diff --git a/web/src/locales/fr.ts b/web/src/locales/fr.ts index 597bb2f..ecd04b8 100644 --- a/web/src/locales/fr.ts +++ b/web/src/locales/fr.ts @@ -864,6 +864,7 @@ export const catalog: Catalog = { "connected": "connecté", "reconnecting…": "reconnexion…", "AGPL-3.0 source": "Code source AGPL-3.0", + "Powered by {product} v{version}": "Propulsé par {product} v{version}", // ── Identities, templates, filters ───────────────────────────────── "Identities & signatures": "Identités et signatures", diff --git a/web/src/locales/ja.ts b/web/src/locales/ja.ts index 922df11..71125fa 100644 --- a/web/src/locales/ja.ts +++ b/web/src/locales/ja.ts @@ -858,6 +858,7 @@ export const catalog: Catalog = { "connected": "接続済み", "reconnecting…": "再接続中…", "AGPL-3.0 source": "AGPL-3.0 ソース", + "Powered by {product} v{version}": "{product} v{version} で動作", // ── Identities, templates, filters ───────────────────────────────── "Identities & signatures": "差出人と署名", diff --git a/web/src/locales/nl.ts b/web/src/locales/nl.ts index 49f02c3..a1224a6 100644 --- a/web/src/locales/nl.ts +++ b/web/src/locales/nl.ts @@ -859,6 +859,7 @@ export const catalog: Catalog = { "connected": "verbonden", "reconnecting…": "opnieuw verbinden…", "AGPL-3.0 source": "AGPL-3.0 broncode", + "Powered by {product} v{version}": "Mogelijk gemaakt door {product} v{version}", // ── Identities, templates, filters ───────────────────────────────── "Identities & signatures": "Identiteiten en handtekeningen", diff --git a/web/src/locales/pt-BR.ts b/web/src/locales/pt-BR.ts index a953dc5..a43ba49 100644 --- a/web/src/locales/pt-BR.ts +++ b/web/src/locales/pt-BR.ts @@ -861,6 +861,7 @@ export const catalog: Catalog = { "connected": "conectado", "reconnecting…": "reconectando…", "AGPL-3.0 source": "Código-fonte AGPL-3.0", + "Powered by {product} v{version}": "Desenvolvido com {product} v{version}", // ── Identities, templates, filters ───────────────────────────────── "Identities & signatures": "Identidades e assinaturas", diff --git a/web/src/locales/ru.ts b/web/src/locales/ru.ts index adb7e4d..f7e67f2 100644 --- a/web/src/locales/ru.ts +++ b/web/src/locales/ru.ts @@ -861,6 +861,7 @@ export const catalog: Catalog = { "connected": "подключено", "reconnecting…": "переподключение…", "AGPL-3.0 source": "Исходный код AGPL-3.0", + "Powered by {product} v{version}": "Работает на {product} v{version}", // ── Identities, templates, filters ───────────────────────────────── "Identities & signatures": "Профили отправителя и подписи", diff --git a/web/src/locales/tr.ts b/web/src/locales/tr.ts index 6a43bc1..91ef2d5 100644 --- a/web/src/locales/tr.ts +++ b/web/src/locales/tr.ts @@ -59,6 +59,7 @@ export const catalog: Catalog = { "A tenant needs a name.": "Bir kiracının bir ada ihtiyacı vardır.", "A to Z": "A'dan Z'ye", "AGPL-3.0 source": "AGPL-3.0 kaynak kodu", + "Powered by {product} v{version}": "{product} v{version} ile çalışır", "AGPL-3.0-or-later · {source}": "AGPL-3.0-or-later · {source}", "About": "Hakkında", "About {app}": "{app} Hakkında", diff --git a/web/src/locales/uk.ts b/web/src/locales/uk.ts index 2a5e2c8..e03636a 100644 --- a/web/src/locales/uk.ts +++ b/web/src/locales/uk.ts @@ -855,6 +855,7 @@ export const catalog: Catalog = { "connected": "підключено", "reconnecting…": "перепідключення…", "AGPL-3.0 source": "Вихідний код AGPL-3.0", + "Powered by {product} v{version}": "Працює на {product} v{version}", // ── Identities, templates, filters ───────────────────────────────── "Identities & signatures": "Профілі відправника та підписи", diff --git a/web/src/locales/zh-Hans.ts b/web/src/locales/zh-Hans.ts index 94b465d..5a77ddc 100644 --- a/web/src/locales/zh-Hans.ts +++ b/web/src/locales/zh-Hans.ts @@ -857,6 +857,7 @@ export const catalog: Catalog = { "connected": "已连接", "reconnecting…": "正在重新连接…", "AGPL-3.0 source": "AGPL-3.0 源代码", + "Powered by {product} v{version}": "由 {product} v{version} 提供支持", // ── Identities, templates, filters ───────────────────────────────── "Identities & signatures": "发件身份与签名", diff --git a/web/src/views/Login.tsx b/web/src/views/Login.tsx index 8abf4ca..d135f43 100644 --- a/web/src/views/Login.tsx +++ b/web/src/views/Login.tsx @@ -8,7 +8,7 @@ import { APP_VERSION } from "@/lib/version"; import { DEFAULT_SOURCE_URL } from "@/lib/source"; import { DEFAULT_APP_NAME, brandImage } from "@/lib/brand"; import { useServerLogo } from "@/lib/serverLogo"; -import { t } from "@/lib/i18n"; +import { t, tNode } from "@/lib/i18n"; import { InbuxaWordmark } from "@/ui/InbuxaWordmark"; export function LoginPage() { @@ -110,10 +110,26 @@ export function LoginPage() { /> )} {/* A product name, not a word: not translated, and not guessed at - from the page it is on. INBUXA's is its wordmark. */} -

- {appName === DEFAULT_APP_NAME ? : appName} -

+ from the page it is on. INBUXA's is its wordmark. + + Under an administrator's own logo the wordmark is a second logo + fighting the first for the card (#122), so it goes, and inbuxa + is credited in the footer instead. The heading stays for screen + readers. A name the administrator set themselves stays: they + chose to show it. While the logo is still being asked for, the + wordmark is held unseen like the image above, so it doesn't + flash up and vanish. */} + {appName === DEFAULT_APP_NAME && serverLogo.status === "custom" ? ( +

{appName}

+ ) : ( +

+ {appName === DEFAULT_APP_NAME ? : appName} +

+ )}

{t("Fast, friendly webmail. Your mailbox, your way.")}

{error && ( @@ -178,12 +194,36 @@ export function LoginPage() { One

with a break rather than two: .foot carries a 20px margin-top, which a second paragraph would repeat as a gap. */} - {/* ihasmail-inbuxa: this build is INBUXA's webmail, and its site is INBUXA's. */} - inbuxa webmail v{APP_VERSION} -
- inbuxa.org - {" · "} - {t("AGPL-3.0 source")} + {/* ihasmail-inbuxa: this build is INBUXA's webmail, and its site is INBUXA's. + Under an administrator's own logo the footer is where inbuxa is + credited (#122): "Powered by", with the name as the link to + inbuxa.org, reads as what it is; a bare "inbuxa.org" under + somebody else's logo read as a stray URL. */} + {serverLogo.status === "custom" ? ( + <> + {tNode( + "Powered by {product} v{version}", + { + product: ( + + inbuxa Webmail + + ), + }, + { version: APP_VERSION }, + )} +
+ {t("AGPL-3.0 source")} + + ) : ( + <> + inbuxa Webmail v{APP_VERSION} +
+ inbuxa.org + {" · "} + {t("AGPL-3.0 source")} + + )}

diff --git a/web/src/views/__tests__/login-custom-logo.test.tsx b/web/src/views/__tests__/login-custom-logo.test.tsx new file mode 100644 index 0000000..cb114a4 --- /dev/null +++ b/web/src/views/__tests__/login-custom-logo.test.tsx @@ -0,0 +1,78 @@ +import { act } from "react"; +import { createRoot, type Root } from "react-dom/client"; +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import type { ServerLogo } from "@/lib/serverLogo"; + +let logo: ServerLogo = { status: "default" }; +vi.mock("@/lib/serverLogo", async (importActual) => ({ + ...(await importActual()), + useServerLogo: () => logo, +})); + +import { LoginPage } from "../Login"; + +(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true; + +/** + * #122: under an administrator's own logo the inbuxa wordmark sat directly + * beneath it, two logos crowding the card. With a custom logo the wordmark + * goes and the footer credits inbuxa as "Powered by inbuxa Webmail". + */ +describe("Sign-in page with a custom logo", () => { + let host: HTMLDivElement; + let root: Root; + + const render = async () => { + await act(async () => { + root.render(); + }); + }; + const heading = () => host.querySelector("h1")!; + const foot = () => host.querySelector(".foot")!; + + beforeEach(() => { + vi.stubGlobal("fetch", vi.fn(() => Promise.resolve(new Response("{}", { status: 200 })))); + host = document.createElement("div"); + document.body.appendChild(host); + root = createRoot(host); + }); + + afterEach(async () => { + await act(async () => root.unmount()); + host.remove(); + vi.unstubAllGlobals(); + }); + + it("shows the wordmark and the plain footer without one", async () => { + logo = { status: "default" }; + await render(); + expect(heading().classList.contains("sr-only")).toBe(false); + expect(heading().querySelector("svg, img")).not.toBeNull(); + expect(foot().textContent).toContain("inbuxa Webmail v"); + expect(foot().textContent).not.toContain("Powered by"); + expect([...foot().querySelectorAll("a")].map((a) => a.textContent)).toEqual(["inbuxa.org", "AGPL-3.0 source"]); + }); + + it("hides the wordmark under a custom logo, keeping the heading for screen readers", async () => { + logo = { status: "custom", url: "/api/logo" }; + await render(); + expect(host.querySelector("img.server-logo")).not.toBeNull(); + expect(heading().classList.contains("sr-only")).toBe(true); + expect(heading().textContent).toBe("inbuxa"); + }); + + it("credits inbuxa in the footer under a custom logo, and keeps the source link", async () => { + logo = { status: "custom", url: "/api/logo" }; + await render(); + expect(foot().textContent).toMatch(/^Powered by inbuxa Webmail v\S+AGPL-3\.0 source$/); + const links = [...foot().querySelectorAll("a")]; + expect(links.map((a) => a.textContent)).toEqual(["inbuxa Webmail", "AGPL-3.0 source"]); + expect(links[0]!.getAttribute("href")).toBe("https://inbuxa.org"); + }); + + it("holds the wordmark unseen while the logo is still being asked for", async () => { + logo = { status: "loading" }; + await render(); + expect(heading().style.visibility).toBe("hidden"); + }); +}); -- 2.54.0