From 24ccc5dc8b320dc46b3aea8efe1fb5f58efc9e8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Smoli=C5=84ski?= Date: Thu, 26 Nov 2026 22:14:50 +0100 Subject: [PATCH] Sign-in look: the logo is handled as the white label handled it in 1.17.0 (owner, 2026-11-26) A logo that showed on a site's login screen shows on the new screens: any picture Site settings holds, an SVG included, as ; svgLogo: false refuses SVG (off by default); the list of allowed types is gone. The look at the file only avoids a broken picture: a file that is gone (404 / 410) or is no picture gives the name; anything else (no answer, a redirect, another status, over 512 KB) believes the upload. Redirects are still never followed by the server, and the body is read with the 512 KB cap. A test checks twelve kinds of logo that 1.17.0 shows. No plate stays the default. Docs, skills, changelog draft. Co-Authored-By: Claude Fable 5.2 --- docs/agent/AGENT.md | 2 +- docs/agent/skills/iapl-reference/SKILL.md | 6 +- .../skills/iapl-reference/resources/api.md | 2 +- docs/agent/skills/iapl-setup/SKILL.md | 4 +- docs/agent/skills/iapl-upgrade/SKILL.md | 4 +- docs/dev/login-page/README.md | 3 +- .../after-2fa-code-dark-logo-svg.png | Bin 0 -> 73560 bytes .../login-page/after-2fa-code-dark-name.png | Bin 75884 -> 75876 bytes .../after-2fa-code-light-logo-svg.png | Bin 0 -> 74281 bytes .../after-2fa-code-phone-logo-svg.png | Bin 0 -> 17766 bytes .../login-page/after-2fa-code-phone-logo.png | Bin 17638 -> 17633 bytes .../login-page/after-2fa-code-phone-name.png | Bin 17252 -> 17242 bytes .../login-page/after-2fa-setup-dark-logo.png | Bin 85019 -> 84764 bytes .../login-page/after-2fa-setup-dark-name.png | Bin 86817 -> 86799 bytes .../login-page/after-2fa-setup-light-name.png | Bin 87218 -> 87213 bytes .../login-page/after-2fa-setup-phone-logo.png | Bin 28564 -> 28553 bytes .../login-page/after-2fa-setup-phone-name.png | Bin 28404 -> 28399 bytes .../dev/login-page/after-forgot-dark-logo.png | Bin 73683 -> 73497 bytes .../login-page/after-forgot-light-logo.png | Bin 73620 -> 73605 bytes .../login-page/after-forgot-light-name.png | Bin 76776 -> 76750 bytes .../login-page/after-forgot-phone-logo.png | Bin 19006 -> 18998 bytes .../login-page/after-forgot-phone-name.png | Bin 18981 -> 18976 bytes .../login-page/after-login-dark-logo-svg.png | Bin 0 -> 73005 bytes docs/dev/login-page/after-login-dark-name.png | Bin 73084 -> 73074 bytes .../after-login-error-light-logo.png | Bin 72593 -> 72476 bytes .../after-login-error-phone-logo.png | Bin 18022 -> 18014 bytes .../after-login-error-phone-name.png | Bin 17887 -> 17882 bytes ...login-light-logo-dark-letters-no-plate.png | Bin 72697 -> 72543 bytes .../login-page/after-login-light-logo-svg.png | Bin 0 -> 73108 bytes .../dev/login-page/after-login-light-logo.png | Bin 72922 -> 72920 bytes .../dev/login-page/after-login-light-name.png | Bin 72967 -> 72814 bytes ...-phone-dark-logo-dark-letters-no-plate.png | Bin 17030 -> 17015 bytes .../after-login-phone-dark-logo-svg.png | Bin 0 -> 16704 bytes .../after-login-phone-dark-name.png | Bin 17242 -> 17238 bytes ...login-phone-logo-dark-letters-no-plate.png | Bin 16818 -> 16810 bytes .../login-page/after-login-phone-logo-svg.png | Bin 0 -> 16692 bytes .../dev/login-page/after-login-phone-logo.png | Bin 16861 -> 16857 bytes .../dev/login-page/after-login-phone-name.png | Bin 16659 -> 16651 bytes ...er-login-pl-logo-dark-letters-no-plate.png | Bin 73089 -> 73084 bytes .../login-page/after-login-pl-logo-svg.png | Bin 0 -> 73290 bytes docs/dev/login-page/after-login-pl-logo.png | Bin 72727 -> 72716 bytes docs/dev/login-page/after-login-pl-name.png | Bin 73228 -> 73225 bytes docs/dev/login-page/changelog-draft.md | 22 ++-- docs/dev/login-page/iawl-current-sign-in.png | Bin 26921 -> 26890 bytes .../login-page/placeholder-logo-for-dark.svg | 1 + docs/white-label.md | 32 +++--- .../.agents/skills/iapl-reference/SKILL.md | 6 +- .../skills/iapl-reference/resources/api.md | 2 +- reference/.agents/skills/iapl-setup/SKILL.md | 4 +- .../.agents/skills/iapl-upgrade/SKILL.md | 4 +- scripts/login-page-shots.mjs | 2 +- src/index.ts | 1 - src/modules/branding/signIn/brand.ts | 77 ++++++++----- src/modules/branding/signIn/index.ts | 1 - src/modules/branding/signIn/options.ts | 10 +- test/signInLook.test.ts | 108 ++++++++++++------ 56 files changed, 177 insertions(+), 114 deletions(-) create mode 100644 docs/dev/login-page/after-2fa-code-dark-logo-svg.png create mode 100644 docs/dev/login-page/after-2fa-code-light-logo-svg.png create mode 100644 docs/dev/login-page/after-2fa-code-phone-logo-svg.png create mode 100644 docs/dev/login-page/after-login-dark-logo-svg.png create mode 100644 docs/dev/login-page/after-login-light-logo-svg.png create mode 100644 docs/dev/login-page/after-login-phone-dark-logo-svg.png create mode 100644 docs/dev/login-page/after-login-phone-logo-svg.png create mode 100644 docs/dev/login-page/after-login-pl-logo-svg.png create mode 100644 docs/dev/login-page/placeholder-logo-for-dark.svg diff --git a/docs/agent/AGENT.md b/docs/agent/AGENT.md index 22257ea..cc133cc 100644 --- a/docs/agent/AGENT.md +++ b/docs/agent/AGENT.md @@ -1171,7 +1171,7 @@ project → **plugin gap**, not a copy. | Mail | `email: mailAdapter()` + `serverURL` — mail works with no other setup, through the Intecion mail service; SMTP in the panel only when the client asks; your own mail: `payload.sendEmail` (`withMailKind` when it is account mail); never a second transport in the project. §7.2 | email.md | | Env validation, health | `assertEnv(iaplEnvRules({…}))` (`/env`), `healthRoute` | env.md | | 2FA, white-label, headers | `twoFactor: { issuer, plugin: payloadTotp }`, `whiteLabel`, `buildSecurityHeaders` | security.md, white-label.md | -| Sign-in screens (login, forgot / reset password, first user, logout, the 2FA screens): a dark panel with the client's logo or the site's name beside the form, language links, both themes, phone | on with `whiteLabel` (`signIn`); a NEW site: `whiteLabel: { signIn: { allScreens: true } }` + `pnpm payload generate:importmap` (adds the provider `SignInLook`; without it only login and the 2FA screens get the look, through `AdminLogo` / `SafeTotpView`). Logo and name come from Site settings (no env var, no new field, no migration). The logo is a bitmap (JPEG, PNG, WebP, AVIF, GIF; an SVG logo shows the name unless `svgLogo: true`), checked by its bytes before it is printed (`checkLogo`), without a plate (`logoPlate: true` for a logo with dark letters). Options: `accent` (hex), `languages: false`; `signIn: false` = Payload's screens. Name / logo / icon are admin-only with the look (`brandAccess: 'editor'` = as before). Never build a login page, a custom `graphics.Logo` or login CSS by hand. Check: `curl -s $URL/admin/login \| grep -c iapl-signin__label` ≥ 1; `curl -si "$URL/api/ipal/admin-language?lng=xx"` → 400 | white-label.md → "The sign-in screens" | +| Sign-in screens (login, forgot / reset password, first user, logout, the 2FA screens): a dark panel with the client's logo or the site's name beside the form, language links, both themes, phone | on with `whiteLabel` (`signIn`); a NEW site: `whiteLabel: { signIn: { allScreens: true } }` + `pnpm payload generate:importmap` (adds the provider `SignInLook`; without it only login and the 2FA screens get the look, through `AdminLogo` / `SafeTotpView`). Logo and name come from Site settings (no env var, no new field, no migration). The logo is whatever Site settings → Logo holds, an SVG too, as `` — the same as on the login screen before (`svgLogo: false` refuses SVG); a file that is gone gives the name instead of a broken picture (`checkLogo`); no plate (`logoPlate: true` for a logo with dark letters). Options: `accent` (hex), `languages: false`; `signIn: false` = Payload's screens. Name / logo / icon are admin-only with the look (`brandAccess: 'editor'` = as before). Never build a login page, a custom `graphics.Logo` or login CSS by hand. Check: `curl -s $URL/admin/login \| grep -c iapl-signin__label` ≥ 1; `curl -si "$URL/api/ipal/admin-language?lng=xx"` → 400 | white-label.md → "The sign-in screens" | | Panel link preview + noindex (site name, description, preview image, technology support credit) | on by default (`adminMeta`, `agency`) — do not hand-write `admin.meta` for it; override single keys in `admin.meta` or `adminMeta: { … }` | white-label.md | | Rate limit (forms, MCP, search) | built in; IP from `IAPL_IP_HEADER`; several instances → `setRateLimitStore` | forms.md | diff --git a/docs/agent/skills/iapl-reference/SKILL.md b/docs/agent/skills/iapl-reference/SKILL.md index 7d290a1..3419d8d 100644 --- a/docs/agent/skills/iapl-reference/SKILL.md +++ b/docs/agent/skills/iapl-reference/SKILL.md @@ -64,13 +64,13 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia | `whiteLabel.logoField` / `iconField` / `nameField` | `'logo'` / `'favicon'` / `'siteName'` | fields in Site settings | any upload/text field | | `whiteLabel.titleSuffix` | none | `admin.meta.titleSuffix` (tab title) | — | | `whiteLabel.credit` | on | `IntecionCredit` in `afterLogin` and `afterNavLinks`: "Technology support: Intecion.com" (en/pl, from `agency`) | `false`; `{ text, url }` overrides | -| `whiteLabel.signIn` | on (with `whiteLabel`) | the sign-in look: a dark panel with the client's logo (Site settings → Logo: JPEG / PNG / WebP / AVIF / GIF, fetched and checked by its bytes before it is printed, ≤ 512 KB, fits 240 × 72, no plate) or the site's name beside the form, "Administration panel", language links; both themes, a band above the form on a phone. Login, the 2FA screens and e-mail verification get it through `AdminLogo` / `SafeTotpView` (already in the import map: an upgrade needs no edit). No env var, no new field, no migration | `false` = Payload's own screens | +| `whiteLabel.signIn` | on (with `whiteLabel`) | the sign-in look: a dark panel with the client's logo (Site settings → Logo, any picture it holds — an SVG too — as ``, exactly what the login screen showed before; fits 240 × 72, no plate) or the site's name beside the form, "Administration panel", language links; both themes, a band above the form on a phone. Login, the 2FA screens and e-mail verification get it through `AdminLogo` / `SafeTotpView` (already in the import map: an upgrade needs no edit). No env var, no new field, no migration | `false` = Payload's own screens | | `whiteLabel.signIn.allScreens` | `false` (the starter writes `true`) | the look on forgot / reset password, create first user, logout and "unauthorized" too: adds the provider `SignInLook` — ONE new import-map entry, run `pnpm payload generate:importmap`. Production start: when `importMap.js` on disk lacks it, the provider is left out and the log says `[iapl] The sign-in look covers only the login and 2FA screens …` | `true` | | `whiteLabel.signIn.accent` | `#0070c0` | hex colour of the button, links and focus ring (anything that is not a hex colour is ignored); or CSS variables `--iapl-signin-*` on `:root` in the admin's `custom.scss` | `'#0b6e4f'` | | `whiteLabel.signIn.logoPlate` | `false` (the logo straight on the dark panel: upload one that works on dark) | `true` = a white plate behind the logo (dark letters) | — | -| `whiteLabel.signIn.checkLogo` | on | the logo's file is fetched as an anonymous visitor gets it and its first bytes read (10-minute memory); a deleted / broken / non-image / > 512 KB file → the site's name; nothing answers → the upload document is believed | `false` = no fetch | +| `whiteLabel.signIn.checkLogo` | on | only against a broken picture: the logo's address is asked once as an anonymous visitor would (no redirect followed, 4 s, ≤ 512 KB read, 10-minute memory); a file that is gone (404 / 410) or is no picture (HTML, PDF) → the site's name; anything else (nothing answers, a redirect, another status, over 512 KB) → the upload is believed | `false` = no fetch | | `whiteLabel.signIn.languages` | shown with 2+ admin languages | links on the panel; `GET /api/ipal/admin-language?lng=` writes Payload's `payload-lng` cookie and redirects (303) back to the admin path of the `Referer`; unknown language → 400 | `false` = no links, no endpoint | -| `whiteLabel.signIn.svgLogo` | `false`: an SVG logo is NOT shown on the sign-in screens (the site's name is) — tell the client to upload a PNG / WebP logo | `true` = shown as a picture (`` runs no script) | — | +| `whiteLabel.signIn.svgLogo` | `true`: an SVG logo is shown as a picture (`` runs no script), as on the login screen before | `false` = an SVG logo is not shown on the sign-in screens (the site's name is) | — | | `whiteLabel.brandAccess` | `'admin'` with the sign-in look (else `'editor'`) | field-level `access.update` on the name, logo and icon fields of Site settings: only admins change what the sign-in screens show; editors keep the rest. No schema change | `'editor'` = whoever edits Site settings | | `agency` | `{ name: 'Intecion.com', url: 'https://intecion.com' }` | the credit line, the panel's link description and preview image | `{ name, url }` = another agency; `false` = none anywhere | | `adminMeta` | on (with or without `whiteLabel`) | panel ``: `robots` noindex/nofollow, `titleSuffix` "— \| Panel", `og:site_name` + description from Site settings (refreshed on save), `og:image` `GET /api/ipal/admin-og` (1200×630 from the logo or name), icon `GET /api/ipal/admin-icon` (favicon or initials); no import map step | `false` = Payload defaults; `{ robots, titleSuffix, description, image, icons, language }` (each `false` or your value; `{site}`, `{agency}` placeholders); your own `admin.meta` keys always win. Check: `curl -s $URL/admin/login \| grep -E 'og:\|robots'` (white-label.md) | diff --git a/docs/agent/skills/iapl-reference/resources/api.md b/docs/agent/skills/iapl-reference/resources/api.md index a65c6e1..ee169a7 100644 --- a/docs/agent/skills/iapl-reference/resources/api.md +++ b/docs/agent/skills/iapl-reference/resources/api.md @@ -626,7 +626,7 @@ Server only (`pnpm payload run`); never import it from client code, the Payload | `resolveRequireSetup(option)`, `strictExempt(fn)`, `SETUP_FROM_FIELD`, `DEFAULT_SETUP_WINDOW_HOURS` | `@intecion/ipal-kit` | `twoFactor.requireSetup` → `{ requireSetup, setupWindowMs, exempt? }` as the guard reads it (throws on a `windowHours` that is not a number ≥ 0 or `false`, and on an `async` `exempt`); the wrapper that makes an `exempt` function answer `true` only for exactly `true`; the field name `'totpSetupFrom'`; `72`. | | `fetchPublicImage(url, base, { timeoutMs? }?)`, `publicImageDataUri(url, base)`, `rasterImageType(bytes)`, `siteOrigin(serverURL)`, `PUBLIC_IMAGE_MAX_BYTES`, `PUBLIC_IMAGE_TIMEOUT_MS` | `@intecion/ipal-kit` | An image fetched the way an anonymous visitor gets it, as `{ bytes, type }` or a `data:` address, else `null`: no cookies; http(s) only; `image/*`; ONE address — a redirect is never followed (a 3xx is "no image"); the whole exchange within `PUBLIC_IMAGE_TIMEOUT_MS` (5000); at most `PUBLIC_IMAGE_MAX_BYTES` (512 KB), reading stops at the limit whatever `content-length` says. `base` is the site's configured origin (`siteOrigin(config.serverURL)` = `serverURL`, else `NEXT_PUBLIC_SERVER_URL`) — never build it from a request's `Host` / `X-Forwarded-Host`. Used for the logo and icon on the 2FA screens and by `/api/ipal/admin-og` and `/api/ipal/admin-icon`. `rasterImageType`: the bitmap type by the first bytes (PNG, JPEG, GIF, WebP, ICO, AVIF), `null` for anything else, SVG included. | | `resolveSignInLook(whiteLabel)` | `@intecion/ipal-kit` | `whiteLabel` option → `null` (white-label or `signIn` off) or `{ allScreens, props }` (`ResolvedSignInLook`; `props` = `SignInLookProps`, the plain values the components get: `accent`, `checkLogo`, `imageField`, `inlineImages`, `languages`, `logoPlate`, `nameField`, `settingsSlug`, `svgLogo`). Option type: `SignInLookOptions`. | -| `loadSignInBrand({ payload, look, locale?, user? })`, `signInName(value, locale?)`, `signInLogo(media, { svgLogo? })`, `checkLogoFile(url, base, allowSvg?)`, `fitLogo(width, height, box?)`, `isSvgUpload(media)`, `SIGN_IN_LOGO_TYPES` | `@intecion/ipal-kit` | What the sign-in panel shows: `{ name, logo }` (`SignInBrand`, `SignInLogo = { src, width?, height? }`) read from Site settings, never throwing; the name as one line of plain text (control characters out, cut at `SIGN_IN_NAME_MAX` = 80); the logo of an upload document — only JPEG / PNG / WebP / AVIF / GIF (`SIGN_IN_LOGO_TYPES`; SVG with `svgLogo: true`), only an `http(s)` or site-relative address, fitted into `SIGN_IN_LOGO_BOX` (240 × 72) without enlarging, served from the smallest generated size ≥ 2× the shown width with the same proportions; the look at the file itself (`LogoCheck`: `{ bytes, type }`, `'bad'` = the server answered and it is no such picture or over 512 KB, `'unknown'` = nothing answered). A session that owes its 2FA code gets the checked picture inlined or no logo. | +| `loadSignInBrand({ payload, look, locale?, user? })`, `signInName(value, locale?)`, `signInLogo(media, { svgLogo? })`, `checkLogoFile(url, base, allowSvg?)`, `fitLogo(width, height, box?)`, `isSvgUpload(media)` | `@intecion/ipal-kit` | What the sign-in panel shows: `{ name, logo }` (`SignInBrand`, `SignInLogo = { src, width?, height? }`) read from Site settings, never throwing; the name as one line of plain text (control characters out, cut at `SIGN_IN_NAME_MAX` = 80); the logo of an upload document — any picture (an SVG too unless `svgLogo: false`; `null` only for an upload whose type says it is no picture, or an address that is not `http(s)` or site-relative), fitted into `SIGN_IN_LOGO_BOX` (240 × 72) without enlarging, served from the smallest generated size ≥ 2× the shown width with the same proportions; the look at the file itself (`LogoCheck`: `{ bytes, type }`; `'bad'` = certainly no picture there: 404 / 410, a 2xx answer of another type, an SVG while refused; `'unknown'` = nothing answered, a redirect (never followed), another status, no type, over 512 KB — the upload is believed). A session that owes its 2FA code gets the checked picture inlined or no logo. | | `signInCss({ accent? })`, `isHexColour(value)`, `SIGN_IN_STYLE_ID` | `@intecion/ipal-kit` | The stylesheet of the sign-in look as a string (no `url()`, no font, no other host; every rule needs `.iapl-signin` on the page), the hex check `accent` must pass, and the `href` of its `