Sign-in look: the logo follows IAWL's rules; no plate by default; the brand fields are admin-only

Bitmaps only (JPEG, PNG, WebP, AVIF, GIF; SVG with svgLogo: true), the file fetched and checked by its
bytes before it is printed (checkLogo; 512 KB; ten-minute memory; an unreachable address is believed),
served from a generated size at least twice the shown width. logoPlate replaces logoMadeFor: no plate
unless asked. With the look on, the name, logo and icon of Site settings are changed by admins only
(brandAccess: 'editor' gives them back). Docs, skills, changelog draft, tests and pictures follow.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 20:52:41 +01:00
co-authored by Claude Fable 5.2
parent 3ceeab8469
commit 939ab679c7
67 changed files with 343 additions and 111 deletions
+32 -17
View File
@@ -45,8 +45,8 @@ whiteLabel: {
| `iconField` | `'favicon'` | `graphics.Icon` → `AdminIcon` (max 28×28 px) |
| `titleSuffix` | none (`adminMeta` builds one from the site name) | static `admin.meta.titleSuffix`, wins over `adminMeta` |
| `credit` | `true` | `false` or `{ text?, url? }` |
| `signIn` | `true` | the look of the sign-in screens (below); `false` = Payload's own screens; `{ allScreens, accent, logoMadeFor, languages, svgLogo }` |
| `brandAccess` | `'editor'` | who may change the name, logo and icon fields: `'admin'` = admins only (field-level access, no schema change) |
| `signIn` | `true` | the look of the sign-in screens (below); `false` = Payload's own screens; `{ allScreens, accent, logoPlate, languages, svgLogo, checkLogo }` |
| `brandAccess` | `'admin'` with the sign-in look | who may change the name, logo and icon fields of Site settings: admins only (field-level access, no schema change); `'editor'` = whoever edits Site settings, as before |
The plugin overrides `admin.components.graphics.Logo` / `Icon` from the project config (its
values win over yours); `afterLogin` / `afterNavLinks` are appended.
@@ -129,10 +129,24 @@ uses too.** No new field, collection or global — so **no migration on Postgres
With nothing set, the panel shows the label and the site's host: no Intecion and no Payload mark is put on a
client's sign-in page (the credit line under the form is separate: `credit: false`).
**The logo.** Shown inside 240 × 72 px (192 × 56 on a phone), never enlarged or cropped, with its `width` and
`height` set (no layout shift). It stands **on a white plate**, so any ordinary logo works on the dark panel; a
logo drawn for dark grounds (a white logo) sets `signIn: { logoMadeFor: 'dark' }` and the plate is left out.
Recommended upload: PNG or WebP, 480 px wide or more, without empty margins.
**The logo — the same rules as on the WordPress sibling (IAWL):**
- **Types:** JPEG, PNG, WebP, AVIF, GIF. **No SVG** (`svgLogo: true` allows it; IAWL has no such switch because
WordPress refuses the upload — Payload accepts SVG uploads, so a site whose logo is an SVG shows its **name** on
the sign-in screens until it uploads a bitmap or sets the option).
- **Looked at before it is printed:** the server fetches the file as an anonymous visitor would (at most 512 KB)
and reads its first bytes. A deleted, broken, renamed, non-image or too large file gives the site's name, never
a broken picture. The answer is remembered for ten minutes. When nothing answers at all (a container that cannot
reach its own public address), the upload document is believed. `checkLogo: false` turns the look off.
- **Size:** fits 240 × 72 px (192 × 56 on a phone), never enlarged or cropped, `width` and `height` set (no
layout shift). Served from the smallest generated size (`imageSizes` of the media collection) that is at least
twice the shown width and has the same proportions; else the upload itself. Recommended: PNG or WebP, 480 px
wide or more, without empty margins.
- **Ground: no plate by default** — the logo stands straight on the dark panel, so Site settings should hold a
logo that works on a dark ground (the owner's choice for new surfaces). A logo drawn for light grounds (dark
letters) sets `signIn: { logoPlate: true }` and gets a white plate. *IAWL differs here today:* its default is the
plate, with `logoMadeFor => 'dark'` to leave it out.
- **Text and link:** the alternative text is the site's name; logo and name link to the site's home page.
### Which screens
@@ -161,9 +175,10 @@ screens … Run "pnpm payload generate:importmap"`. Without `allScreens` the oth
| `false` | — | Payload's own sign-in screens; `AdminLogo` is the plain logo, as before |
| `allScreens` | `false` | the look on every sign-in screen (above) |
| `accent` | the shared blue `#0070c0` | a hex colour for the button, the links and the focus ring; it carries white text, so check its contrast (4.5:1) |
| `logoMadeFor` | `'light'` | `'dark'`: no white plate behind the logo |
| `logoPlate` | `false` | `true`: a white plate behind the logo (a logo with dark letters) |
| `languages` | shown when the panel has 2+ languages | `false`: no language links, and no `/api/ipal/admin-language` endpoint |
| `svgLogo` | shown (as a picture) | `false`: an SVG logo is not shown on the sign-in screens; the site's name is |
| `svgLogo` | `false` | `true`: an SVG logo is shown too (as a picture, where it cannot run script) |
| `checkLogo` | `true` | `false`: the logo's file is not fetched and looked at before it is printed |
**Language links.** Plain links, no script: `GET /api/ipal/admin-language?lng=pl` writes Payload's own language
cookie (`payload-lng`, one year) and sends the browser back to the admin page it came from. Public, because nobody
@@ -177,14 +192,14 @@ The sign-in page is open to anyone, so what reaches it is narrow on purpose:
- **Text:** the site's name only, as plain text (escaped; one line, at most 80 characters). No description, no
rich text, no link an editor can write: the panel's only links are the site's own root and the language links.
- **Pictures:** the logo as an `<img>` — a picture in `<img>` never runs script, an SVG included. `svgLogo: false`
leaves SVG out anyway. Only an `http(s)` or site-relative address is used. The plugin serves **no new file** for
it: the logo is the media file at its own address, with the media collection's own headers and cache rules. On
the 2FA screens (the session is refused `media`) the server fetches it as an anonymous visitor would — images
only, at most 512 KB — and inlines it; when that fails the name is shown (`inlineImages`, above).
- **Who can change it:** whoever may edit Site settings — editors and admins by default, as for the public site's
name and logo. `whiteLabel: { brandAccess: 'admin' }` makes the three brand fields (name, logo, icon)
admin-only with field-level access; other Site settings stay with editors.
- **Pictures:** the logo as an `<img>`, bitmaps only (above), checked by its bytes, at most 512 KB; only an
`http(s)` or site-relative address is used. The plugin serves **no new file** for it: the logo is the media file
at its own address, with the media collection's own headers and cache rules. On the 2FA screens (the session is
refused `media`) the picture that was just checked is put into the page as a `data:` image; when it could not
be fetched the name is shown (`inlineImages`, above).
- **Who can change it: admins.** With the sign-in look on, the three brand fields of Site settings (name, logo,
icon) get field-level access for admins only; an editor still edits every other Site setting and sees these
three read-only. No schema change. `whiteLabel: { brandAccess: 'editor' }` gives them back to editors.
- **Accounts:** the forms, their messages and their limits are Payload's and the 2FA package's own, untouched.
The look adds no text that depends on an account, so nothing new says whether an account exists.
- **The stylesheet** is inline, has no `url()`, no font file and no request to another host; `accent` is accepted
@@ -221,7 +236,7 @@ Set the custom properties on `:root` in the admin's `custom.scss` (the defaults
- **Your own panel:** `SignInPanel` (the panel with its stylesheet) and `SignInLook` (the provider) are exported
from `@intecion/ipal-kit/admin`; wire them in `admin.components` with `serverProps: { look: { … } }`
(`SignInLookProps`). From the main entry: `resolveSignInLook`, `loadSignInBrand`, `signInLogo`, `signInName`,
`fitLogo`, `isSvgUpload`, `languageLinks`, `LANGUAGE_NAMES`, `signInCss`, `isHexColour`, `signInProviderActive`,
`checkLogoFile` (`LogoCheck`), `SIGN_IN_LOGO_TYPES`, `fitLogo`, `isSvgUpload`, `languageLinks`, `LANGUAGE_NAMES`, `signInCss`, `isHexColour`, `signInProviderActive`,
`buildAdminLanguageEndpoint`, `adminPathFromReferer`, and the constants `SIGN_IN_LOOK`, `SIGN_IN_STYLE_ID`,
`SIGN_IN_LOGO_BOX`, `SIGN_IN_NAME_MAX`, `ADMIN_LANGUAGE_PATH`; types `SignInLookOptions`, `ResolvedSignInLook`,
`SignInLookProps`, `SignInBrand`, `SignInLogo`, `LanguageLink`, `SignInPanelProps`, `SignInLookProviderProps`.