Sign-in look: the client's logo or the site's name on a dark panel beside the form (whiteLabel.signIn)
On by default with whiteLabel. The login screen and the 2FA screens get the look through AdminLogo and SafeTotpView, which every site already has in its import map: an upgrade needs no edit. allScreens adds one provider (SignInLook) for forgot / reset password, first user and logout; a production start leaves it out when the import map on disk lacks it. Logo and name come from Site settings: no new field, no migration. Language links through GET /api/ipal/admin-language (Payload's own cookie, back to an admin path only). Options: accent, logoMadeFor, languages, svgLogo; whiteLabel.brandAccess 'admin'. The 2FA code boxes get names for screen readers. Reference site and starter: allScreens on. Docs, agent guide, skills, tests. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
e821d52d19
commit
b6c91a3a11
@@ -1171,6 +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). Options: `accent` (hex), `logoMadeFor: 'dark'`, `languages: false`, `svgLogo: false`; `signIn: false` = Payload's screens; `brandAccess: 'admin'` = only admins change name / logo / icon. 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 |
|
||||
|
||||
|
||||
@@ -1171,6 +1171,7 @@ Rules: AGENT.md §8a.
|
||||
| `e2e/mail-relay-fixture.ts` | test fixture, on only with E2E_MAIL_RELAY_URL: points the mail service's client at the stand-in the spec starts; never in a real site (a real site names no address) (below) |
|
||||
| `e2e/mail-relay-setup.ts` | for the mail-service spec: empties the SMTP fields and the stored token, so the next e-mail enrols and goes through the mail service (local database only) (below) |
|
||||
| `e2e/mail-relay.spec.ts` | the mail service on a built site: the state block in the panel, the first e-mail through the public confirm route, no token in anything the browser receives |
|
||||
| `e2e/sign-in-look.spec.ts` | browser test of the sign-in look (whiteLabel.signIn): the panel comes with the form, sits above it on a phone in both themes, is on forgot / reset / logout too, the language links work, the 2FA code screen keeps its boxes (now named) |
|
||||
| `e2e/smoke.spec.ts` | the smoke tests every release must pass: pages, showcase, forms (also a file sent by e-mail), sitemap, SEO/GEO, headers, consent, 2FA |
|
||||
| `e2e/smtp-sink.ts` | a local mail sink for the smoke tests: reads what the site really sent (recipients, attachments) |
|
||||
| `e2e/totp.ts` | RFC 6238 code generator for the 2FA sign-in in the smoke test, and the address of the second test admin (below) |
|
||||
|
||||
@@ -64,6 +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, on a white 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.logoMadeFor` | `'light'` | `'dark'` = a logo drawn for dark grounds: no white plate | — |
|
||||
| `whiteLabel.signIn.languages` | shown with 2+ admin languages | links on the panel; `GET /api/ipal/admin-language?lng=<code>` 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` | shown as a picture (`<img>` runs no script) | `false` = an SVG logo is not shown on the sign-in screens; the site's name is | — |
|
||||
| `whiteLabel.brandAccess` | `'editor'` (whoever edits Site settings) | `'admin'` = field-level `access.update` on the name, logo and icon fields: only admins change what the sign-in screens show. No schema change | — |
|
||||
| `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 `<head>`: `robots` noindex/nofollow, `titleSuffix` "— <site> \| 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) |
|
||||
| `pages` | none | Site settings → **System pages** (page roles) and **Maintenance** tabs | omit → neither tab |
|
||||
@@ -153,6 +160,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ia
|
||||
|---|---|---|
|
||||
| `AdminLogo`, `AdminIcon` | `graphics.Logo/Icon` | `whiteLabel` |
|
||||
| `IntecionCredit` | `afterLogin`, `afterNavLinks` | `whiteLabel` and `credit !== false` |
|
||||
| `SignInLook` | `providers` (last) | `whiteLabel.signIn.allScreens` — the only entry the sign-in look adds; without it nothing new is needed |
|
||||
| `StatsNavLink`, `StatsView` (`views.ipalStats`, `/stats`), `StatsWidget` (`beforeDashboard`) | nav, view, dashboard | `stats` (`dashboard: false` without the widget) |
|
||||
| `CookieScanButton` | `beforeListTable` of `cookie-review` (with **Check site** when `crawl` is on) | `cookieScanner` |
|
||||
| `CookieReviewTab`, `CookieSiteCheckTab` | `ui` fields in the `cookie-settings` tabs | `cookieScanner` with `adminLayout !== 'separate'` (Site check: `crawl`) |
|
||||
|
||||
@@ -38,6 +38,8 @@ Admin panel components from `@intecion/ipal-kit/admin` — the project does NOT
|
||||
| `TwoFactorResetButton` | `@intecion/ipal-kit/admin` | Client button inside `TwoFactorStatusField`: `POST /api/ipal/two-factor/reset` `{ userId }`, then reloads the view. Props `{ kind: 'reset' \| 'reopen', userId }`. |
|
||||
| `TwoFactorAlert` | `@intecion/ipal-kit/admin` | Server component on the dashboard (`beforeDashboard`), administrators only: accounts without two-step verification and how many are blocked. Wired by the plugin with `twoFactor.requireSetup`; renders nothing when every account has it. |
|
||||
| `IntecionCredit` | `@intecion/ipal-kit/admin` | The line "Technology support: Intecion.com" (admin language; `agency` prop = the name) below the nav and below the login form (`variant: 'nav' \| 'login'`). Injected by the plugin with `whiteLabel`; turn off: `whiteLabel: { credit: false }` or `agency: false`. |
|
||||
| `SignInPanel` | `@intecion/ipal-kit/admin` | Server component: the dark sign-in panel with its stylesheet (`<style>` deduplicated by React) — label, the logo or the site's name from Site settings as a link to the site, language links. Props `look` (`SignInLookProps`) plus what Payload injects (`payload`, `i18n`, `locale`, `user`); `SignInPanelProps`. Hidden by its own CSS on any page that is not Payload's minimal template. `AdminLogo` (prop `signIn`) and `SafeTotpView` (prop `iaplSignIn`) render it when the provider does not. |
|
||||
| `SignInLook` | `@intecion/ipal-kit/admin` | Admin provider (`admin.components.providers`, `serverProps: { look }`; `SignInLookProviderProps`): prints `SignInPanel` on every admin page so that every minimal screen has it. Registered by `whiteLabel: { signIn: { allScreens: true } }`. |
|
||||
| `buildAdminMeta({ agency, apiRoute?, defaultLocale?, meta?, options? })` | `@intecion/ipal-kit` | The `adminMeta` step: static panel meta (robots, preview image, icon) without overwriting keys in `meta`; returns `{ meta, resolved }` |
|
||||
| `adminMetaForSite(site, resolved)`, `syncAdminMeta(payload, resolved, { nameField?, settingsSlug? })` | `@intecion/ipal-kit` | Site-name parts (suffix, description, siteName); `syncAdminMeta` writes them into the live config (onInit + Site settings afterChange, never throws) |
|
||||
| `buildAdminImageEndpoints(resolved, { settingsSlug?, nameField?, logoField?, iconField? })` | `@intecion/ipal-kit` | `GET /api/ipal/admin-og` (1200×630 PNG via `next/og`) and `GET /api/ipal/admin-icon` (the favicon itself, or initials) — already added by `adminMeta` |
|
||||
@@ -623,6 +625,11 @@ Server only (`pnpm payload run`); never import it from client code, the Payload
|
||||
| `countAccountsWithoutTotp(payload, collection, setupWindowMs?)` | `@intecion/ipal-kit` | `{ without, blocked }` — accounts of the 2FA collection without TOTP, and how many are past their window. |
|
||||
| `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)`, `publicImageDataUri(url, base)`, `rasterImageType(bytes)`, `siteOrigin(serverURL)`, `PUBLIC_IMAGE_MAX_BYTES` | `@intecion/ipal-kit` | An image fetched the way an anonymous visitor gets it (no cookies; http(s) only; `image/*`; at most 512 KB, reading stops at the limit) as `{ bytes, type }` or a `data:` address, else `null`. Used for the logo and icon on the 2FA screens. `rasterImageType(bytes)` → the media type of a bitmap by its first bytes (PNG, JPEG, GIF, WebP, ICO, AVIF) or `null` — never trust a claimed type before answering a file's bytes from the site's origin; an SVG gives `null`. |
|
||||
| `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`, `imageField`, `inlineImages`, `languages`, `logoMadeFor`, `nameField`, `settingsSlug`, `svgLogo`). Option type: `SignInLookOptions`. |
|
||||
| `loadSignInBrand({ payload, look, locale?, user? })`, `signInName(value, locale?)`, `signInLogo(media, { svgLogo? })`, `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 (only an `http(s)` or site-relative address; `null` for SVG with `svgLogo: false`), fitted into `SIGN_IN_LOGO_BOX` (240 × 72) without enlarging. A session that owes its 2FA code gets the picture inlined (`publicImageDataUri`) 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 `<style>` (`'iapl-sign-in'`). |
|
||||
| `languageLinks(config, current)`, `LANGUAGE_NAMES`, `buildAdminLanguageEndpoint()`, `adminPathFromReferer(referer, adminRoute)`, `ADMIN_LANGUAGE_PATH` | `@intecion/ipal-kit` | The panel's languages as links (`LanguageLink[]`: `{ code, name, current, href }`; empty with one language; names in their own language, else the code); the public endpoint `GET /api/ipal/admin-language?lng=` (`'/ipal/admin-language'`) that writes `<cookiePrefix>-lng` for a supported language (else 400) and answers 303 to a path inside the admin route taken from the `Referer` (anything else → the admin root, never another host). |
|
||||
| `signInProviderActive(payload)`, `SIGN_IN_LOOK` | `@intecion/ipal-kit` | Whether the provider `'@intecion/ipal-kit/admin#SignInLook'` is in the config AND in the running import map — `AdminLogo` and `SafeTotpView` print the panel themselves only when it is not. |
|
||||
| `UPLOAD_SECURITY_HEADERS` | `@intecion/ipal-kit` | The two headers of `buildUploadSecurityHeaders` (`Content-Security-Policy: default-src 'none'; … sandbox`, `X-Content-Type-Options: nosniff`) for a route of your own that returns an uploaded file's bytes from the site's origin. In a Next project a site-wide `headers()` rule with the same key overrides a header the route sets itself: add a `headers()` rule for the path after the site-wide one (as `buildUploadSecurityHeaders({ collections, adminIcon })` does for the upload routes and `/api/ipal/admin-icon`), and never answer with an SVG. |
|
||||
| `twoFactorSetupState(req)`, `twoFactorSetupDeadline(req)` | `@intecion/ipal-kit` | Where an account stands with TOTP setup, from `{ payload, user }`: `'set-up'`, `'open'` (may set it up now), `'closed'` (the setup window has passed: blocked until an admin reopens it), `'exempt'` (`requireSetup.exempt`, or `requireSetup: false`), `'not-applicable'` (no user, another collection, 2FA off); and the moment setup closes (`Date`, or `null` without a window). Types: `TwoFactorSetupState`, `RequireSetupOptions`. |
|
||||
| `requireSecondFactor(access?)` | `@intecion/ipal-kit` | Wraps an `Access` function: refused while the second factor is owed, otherwise the function itself (Payload's default "logged in" when none). iapl applies it to every collection and global in the config, and to those added by plugins listed after it (in `onInit` and at the start of the first request, so also after a dev hot reload); use it for access functions that are not part of the config. Per-entity opt-out: `custom.ipal.secondFactor: false \| { read: false }` or the package's `custom.totp.disableAccessWrapper`. Wrapping twice is harmless. |
|
||||
|
||||
@@ -188,7 +188,7 @@ export default buildConfig({
|
||||
seo: { collections: ['pages'] },
|
||||
forms: { redirectRelationships: ['pages'] },
|
||||
twoFactor: { issuer: '<Client name>', plugin: payloadTotp },
|
||||
whiteLabel: true,
|
||||
whiteLabel: { signIn: { allScreens: true } }, // client's logo / name on every sign-in screen (white-label.md)
|
||||
indexNow: true,
|
||||
// consentLog is on by default (1.17.0): consent-records + POST /api/ipal/consent; `consentLog: false` turns it off.
|
||||
// Postgres / SQLite: pnpm payload migrate:create consent-log, applied in the same deploy.
|
||||
@@ -207,7 +207,7 @@ are never added to a new site. Local `.env` with `PAYLOAD_SECRET` ≥ 32 charact
|
||||
One language: one entry in `locales`, no `[locale]` folder (i18n.md).
|
||||
|
||||
**Check.** `pnpm payload generate:importmap` (whiteLabel adds admin components) and `pnpm generate:types` without
|
||||
errors (the import map lists `@intecion/ipal-kit/admin#TotpRedirectProvider` and `#SafeTotpView`); `pnpm dev`, `/admin`: first-user screen → after saving, TOTP setup is enforced (`/admin/setup-totp?back=%2Fadmin`, QR, no reloading);
|
||||
errors (the import map lists `@intecion/ipal-kit/admin#TotpRedirectProvider`, `#SafeTotpView` and `#SignInLook`); `pnpm dev`, `/admin`: first-user screen → after saving, TOTP setup is enforced (`/admin/setup-totp?back=%2Fadmin`, QR, no reloading);
|
||||
the panel shows Site settings, Site integrations, Cookies, Form messages, the Forms group, Consent records.
|
||||
`curl -s -o /dev/null -w '%{http_code}' -X POST localhost:3000/api/ipal/consent -H 'content-type: application/json'
|
||||
-d '{"id":"0123456789abcdef","version":1,"state":{"necessary":true,"functional":false,"analytics":false,"marketing":false}}'` → `201`.
|
||||
@@ -294,6 +294,12 @@ the panel shows Site settings, Site integrations, Cookies, Form messages, the Fo
|
||||
win; a function `(global) => global` takes over). Without `revalidatePath` global saves wait for the ISR window.
|
||||
- `whiteLabel: { credit: false, titleSuffix, settingsSlug, logoField, … }`; with `whiteLabel` the plugin overrides
|
||||
`graphics.Logo/Icon` — your own graphics only without it.
|
||||
- Sign-in screens (`whiteLabel.signIn`, on): a dark panel with the client's logo or the site's name beside the
|
||||
form; the logo and name are Site settings fields (no env var, no migration). `allScreens: true` (in the config
|
||||
above) adds the provider `SignInLook` to the import map and covers forgot / reset password, first user and
|
||||
logout. `accent: '#hex'`, `logoMadeFor: 'dark'` (a white logo), `languages: false`, `svgLogo: false`;
|
||||
`signIn: false` = Payload's screens; `brandAccess: 'admin'` = only admins change name, logo and icon.
|
||||
Check: `/admin/login` and `/admin/forgot` show the panel, also at a phone width; do not write login CSS by hand.
|
||||
- Panel link preview (`adminMeta`, on): noindex/nofollow, "— <site> | Panel" suffix, site name, description and
|
||||
preview image (`/api/ipal/admin-og`) from Site settings; `agency` names who supports the technology (default
|
||||
Intecion.com). Turn off: `adminMeta: false`, `agency: false`; your own `admin.meta` keys win. Check:
|
||||
|
||||
@@ -648,6 +648,22 @@ PROGRAMISTA §6, items 73–75; email.md; AGENT.md §7.2) — nothing to run; re
|
||||
**Send test e-mail** names the transport you expect; a form submission arrives. **The service is live at
|
||||
`https://webservices.intecion.net/mail`; while the service runs with enrolment "pending" (from its launch until Intecion switches to open enrolment), every new site waits for approval — keep SMTP until it is approved, or `relay: false`.**
|
||||
|
||||
**→ 1.18.0, the sign-in look (CHANGELOG 1.18.0; white-label.md → "The sign-in screens") — nothing is required:**
|
||||
1. **Sites with `whiteLabel`:** after the update the login screen and the 2FA screens (code, setup) have the new
|
||||
look — a dark panel with the client's logo or the site's name beside the form. No edit, no
|
||||
`generate:importmap`, no migration: the look comes through `AdminLogo` and `SafeTotpView`, which the site's
|
||||
import map already has. **Check:** open `/admin/login` on a desktop and at a phone width, in both themes; sign
|
||||
in through 2FA. A logo that looks wrong on the white plate (a white logo): `signIn: { logoMadeFor: 'dark' }`.
|
||||
2. **Tell the owner the sign-in page looks different** and ask whether to keep it. No: `whiteLabel: { signIn: false }`
|
||||
— Payload's screens with the plain logo, as before (record it in AGENTS.md → Project decisions).
|
||||
3. **Recommended, one edit:** `whiteLabel: { signIn: { allScreens: true } }`, `pnpm payload generate:importmap`,
|
||||
commit `importMap.js` — forgot / reset password, create first user and logout get the same look. Forgetting
|
||||
the import map does not break the panel: at a production start the provider is left out and the log says so.
|
||||
4. **Project CSS for the login screen** (`custom.scss` rules on `.login`, `.template-minimal`, a hand-made
|
||||
`graphics.Logo`): look at the screens after the update; the look's own rules win over Payload's layer but not
|
||||
over the project's later ones. Restyle with the `--iapl-signin-*` variables instead.
|
||||
5. Sites **without** `whiteLabel`: nothing changes.
|
||||
|
||||
## 2. Inventory (no code changes)
|
||||
**What changed for projects** between your old and new plugin version is exactly the reference site's diff —
|
||||
`git diff v<old> v<new> -- reference/` in the IAPL repo (or the two `docs/agent/reference-site/INDEX.md` files):
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
# The panel's sign-in screens: design notes and screenshots
|
||||
|
||||
Design record of `whiteLabel.signIn` (the user-facing page is [white-label.md](../../white-label.md) → "The sign-in
|
||||
screens"). The goal: IAPL's sign-in looks like IAWL's (the WordPress sibling), and both have a place for the client's
|
||||
logo.
|
||||
|
||||
## Files here
|
||||
|
||||
Made with `node scripts/login-page-shots.mjs` (headless Chromium, 1280 × 800 and 390 × 844) against the reference
|
||||
site; `after-*` from a production build with `signIn: { allScreens: true }`, `before-*` from main (1.17.0).
|
||||
|
||||
| Files | What |
|
||||
|---|---|
|
||||
| `before-*.png` | IAPL 1.17.0: login (light, dark, phone, Polish, wrong password), forgot password, 2FA code, 2FA setup; `-logo` = with a logo set |
|
||||
| `after-*-name.png` | the new look with no logo set: the site's name |
|
||||
| `after-*-logo.png` | the new look with a logo (`placeholder-logo.png`, drawn for these pictures) |
|
||||
| `iawl-*.png` | IAWL's sign-in page, copied from its repository (`docs/reviews/white-label/`, made 2026-11-24). Two later changes are not in them: the languages are plain links now (no drop-down with a button), and messages are square boxes with a straight bar |
|
||||
| `placeholder-logo*.png` | the placeholder logos (dark text; white text for `logoMadeFor: 'dark'`) |
|
||||
|
||||
Screens: `login-{light,dark,phone,phone-dark,pl}`, `login-error-{light,phone}`, `forgot-{light,dark,phone}`,
|
||||
`2fa-code-{light,dark,phone}`, `2fa-setup-{light,dark,phone}`. Create-first-user needs a database without users
|
||||
(`--only=first-user`); it uses the same template and was checked by hand, not photographed.
|
||||
|
||||
## What defines IAWL's sign-in page (read from `plugin/assets/sign-in/sign-in.css`, `SignInLook.php`, `Logo.php`, `LanguageSwitcher.php`)
|
||||
|
||||
- **Layout:** two columns, 5 : 6. Left: a dark panel (`#060606`) inset 10 px from the window's edge, 20 px corners,
|
||||
a faint grid (3.5 × 2.5 rem cells, 4 % white lines) and two blue glows (`rgb(0 158 246)`, 22–24 %). Right: a white
|
||||
page with the form, 28 rem wide, centred in its column. No card around the form.
|
||||
- **On the panel**, at the bottom: a label "ADMINISTRATION PANEL" (mono, 14 px, 600, upper case, 0.05 em tracking,
|
||||
`#b2b2b2`, a 5 px blue square before it), then the logo on a white plate (12 px corners, 16 × 20 px padding; the
|
||||
logo fits 240 × 72) or the site's name as text (weight 500, −0.03 em, clamp 36–60 px). Both link to the site.
|
||||
- **Form:** labels above fields, 48 px fields with a 1 px `#80868f` border and 6 px corners, a full-width 50 px blue
|
||||
button (`#0070c0`, hover `#005a9e`, white text), links `#006bb8` underlined, focus ring 2 px `#017bd0`.
|
||||
- **Under the form:** links (lost password, back to the site), the languages as links, a hairline, and the credit
|
||||
"Technology support: Intecion.com" (13 px, muted, centred).
|
||||
- **Messages:** boxes above the form with a 4 px bar on the leading edge: red for errors, green for success.
|
||||
- **Phone (≤ 52 rem):** the panel is a band above the form, bottom corners rounded, the logo 192 × 56.
|
||||
- **Theme:** none: the panel is always dark, the form always light. **Fonts:** Outfit / Inter / Roboto Mono from
|
||||
local files, part of the credit (off with `credit => false`). **Script:** one optional file, the grid light that
|
||||
follows the mouse.
|
||||
- **States:** WordPress's own (errors, lost password, reset with the strength meter, logged out, interim frame);
|
||||
IAWL changes the look only.
|
||||
|
||||
## How IAPL maps it
|
||||
|
||||
| Element | IAPL | Same as IAWL? |
|
||||
|---|---|---|
|
||||
| Split, panel inset and corners, grid, glows, colours | the same numbers (`css.ts`) | yes |
|
||||
| Label, plate, logo box, name as text, link to the site | the same | yes |
|
||||
| Button, link, focus and border colours; field and button heights; 28 rem column | the same | yes |
|
||||
| Phone band at 52 rem | the same | yes |
|
||||
| Languages | links, **on the panel** (top corner; under the brand on a phone), because the form's markup is Payload's and differs per screen | place differs |
|
||||
| Credit line | under the login form, hairline above (login only, as before) | IAWL: every screen |
|
||||
| Dark theme | the form's side follows the admin theme; the panel stays dark | IAWL has no dark form |
|
||||
| Fonts | the admin's own font stack and the system's mono; no font file | differs (no extra request before sign-in) |
|
||||
| Grid light (script) | not built: no script on the sign-in page | differs |
|
||||
| Messages | Payload's own toasts and field errors, unchanged | differs |
|
||||
| Field look | Payload's fields with the shared border colour and height | close |
|
||||
|
||||
## Decisions
|
||||
|
||||
1. **Carried by components every site already has.** A new admin component needs a new import-map entry, and a
|
||||
provider missing from the map blanks the whole panel. So `AdminLogo` prints the panel on the login screen and
|
||||
`SafeTotpView` in front of the 2FA screens; only `allScreens` adds a provider (`SignInLook`), guarded at start.
|
||||
2. **The panel is one self-contained element**, fixed on a desktop and in the flow on a phone, hidden by its own
|
||||
CSS off the minimal template. It therefore works wherever it is printed (inside the login form's wrapper, before
|
||||
a 2FA view, at the top of the body).
|
||||
3. **No new stored data.** Logo and name are Site settings fields that exist since 1.0: no migration. The plate
|
||||
switch (`logoMadeFor`) and the accent are code options; putting them in the panel would add columns on SQL.
|
||||
4. **Payload draws its admin screens in the browser** (the server's HTML body is empty until React runs), so "no
|
||||
flash" means: the panel, its stylesheet and the form appear in the same step. The e2e spec checks that the
|
||||
form's template is never in the page without them.
|
||||
@@ -0,0 +1,48 @@
|
||||
# Changelog draft — the sign-in look (for the next minor, written as 1.18.0)
|
||||
|
||||
To be placed in `docs/CHANGELOG.md` by the release; the version number is the integration session's call.
|
||||
|
||||
## Read before upgrading
|
||||
|
||||
**The panel's sign-in page looks different on every site with `whiteLabel`.** After the update the login screen and
|
||||
the 2FA screens (code, setup) show a dark panel with the client's logo — or the site's name — beside the form, the
|
||||
look IAPL now shares with IAWL. No edit, no `generate:importmap`, no migration, no new env var.
|
||||
Keep Payload's screens: `whiteLabel: { signIn: false }`. Sites without `whiteLabel`: nothing changes.
|
||||
|
||||
## Added
|
||||
|
||||
- **Sign-in look (`whiteLabel.signIn`, on with `whiteLabel`).** A dark panel with the label "Administration panel",
|
||||
the client's logo on a white plate (Site settings → Logo) or the site's name, and the panel's languages as links;
|
||||
the form beside it, in both admin themes; a band above the form on a phone. Logo and name come from Site settings:
|
||||
no env var, **no new field, no schema change** (MongoDB, Postgres, SQLite alike). With nothing set the panel shows
|
||||
the label and the site's host — no Payload or Intecion mark.
|
||||
- **`signIn: { allScreens: true }`** — the same look on forgot / reset password, create first user, logout and
|
||||
"unauthorized". Adds the provider `SignInLook` (one import-map entry: `pnpm payload generate:importmap`). The
|
||||
project starter writes it for new sites. A production start that does not find the entry in `importMap.js`
|
||||
leaves the provider out and logs what to run; the panel keeps working.
|
||||
- **Options:** `signIn.accent` (hex colour of the button, links and focus ring), `signIn.logoMadeFor: 'dark'` (a
|
||||
white logo: no plate), `signIn.languages: false`, `signIn.svgLogo: false` (an SVG logo is not shown on the sign-in
|
||||
screens), `whiteLabel.brandAccess: 'admin'` (only admins change the name, logo and icon in Site settings;
|
||||
field-level access, no schema change). CSS variables `--iapl-signin-*` for a project's `custom.scss`.
|
||||
- **Language links before sign-in:** `GET /api/ipal/admin-language?lng=<code>` writes Payload's language cookie for
|
||||
a supported language and returns to the admin page it was opened from (public; 400 for an unknown language;
|
||||
never redirects off the admin route). Registered only with the sign-in look and `languages !== false`.
|
||||
- **The 2FA code boxes have names** for screen readers ("Digit 2 of 6") and ask a phone for the numeric keyboard
|
||||
(with the sign-in look).
|
||||
- Exports: `SignInPanel`, `SignInLook` (`/admin`); `resolveSignInLook`, `loadSignInBrand`, `signInLogo`,
|
||||
`signInName`, `fitLogo`, `isSvgUpload`, `languageLinks`, `LANGUAGE_NAMES`, `signInCss`, `isHexColour`,
|
||||
`signInProviderActive`, `buildAdminLanguageEndpoint`, `adminPathFromReferer`, `SIGN_IN_LOOK`, `SIGN_IN_STYLE_ID`,
|
||||
`SIGN_IN_LOGO_BOX`, `SIGN_IN_NAME_MAX`, `ADMIN_LANGUAGE_PATH` and their types.
|
||||
|
||||
## Changed
|
||||
|
||||
- `AdminLogo` prints the sign-in panel when the plugin gives it `signIn` (the default with `whiteLabel`); wired by
|
||||
hand without that prop it is the plain logo as before. The logo on the login screen is now shown inside
|
||||
240 × 72 px (it was up to 420 × 120).
|
||||
- The credit line under the login form: full-strength muted colour and a hairline above it (it was 60 % opacity).
|
||||
- The reference site and the starter use `whiteLabel: { signIn: { allScreens: true } }`.
|
||||
|
||||
## Requires project changes
|
||||
|
||||
None. Recommended: `allScreens` (one config line, regenerate the import map). A project with its own CSS for the
|
||||
login screen looks at the result after the update.
|
||||
+125
-9
@@ -1,6 +1,6 @@
|
||||
# white-label — admin panel branding from the admin panel
|
||||
|
||||
The admin panel shows the **client's brand** (logo + name) on the login screen and in
|
||||
The admin panel shows the **client's brand** (logo + name) on the sign-in screens and in
|
||||
the navigation, taken from **SiteSettings** — i.e. set by the editor in the admin panel,
|
||||
not hard-coded. Each client logs in to "their own" panel.
|
||||
|
||||
@@ -45,6 +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) |
|
||||
|
||||
The plugin overrides `admin.components.graphics.Logo` / `Icon` from the project config (its
|
||||
values win over yours); `afterLogin` / `afterNavLinks` are appended.
|
||||
@@ -109,12 +111,123 @@ image. The plugin now fills the panel's `<head>` from Site settings, **with or w
|
||||
`og:site_name` = the site name, `og:image` = `/api/ipal/admin-og`; open `$URL/api/ipal/admin-og` → the
|
||||
preview image; paste the link in Slack → the site's name and image.
|
||||
|
||||
## Logo on the login screen
|
||||
## The sign-in screens — `whiteLabel.signIn` (on by default with `whiteLabel`)
|
||||
|
||||
`AdminLogo` is the LARGE logo on the login screen (Payload uses `graphics.Icon` for
|
||||
the small icon in the navigation). It renders quite a bit larger (`maxHeight 120 / maxWidth
|
||||
420`), so the client's brand is clear at login. The small nav icon is `favicon`
|
||||
through `AdminIcon`.
|
||||
One look for every screen a person passes before the panel: **a dark panel with the client's logo — or the site's
|
||||
name — beside the form**, the same look as the WordPress sibling (IAWL). On a phone the panel is a band above the
|
||||
form. The panel is dark in both themes; the form's side follows the admin theme (light or dark).
|
||||
|
||||
| On the panel | From | When it is missing |
|
||||
|---|---|---|
|
||||
| Label "Administration panel" (pl: "Panel administracyjny") | the plugin's texts (`ipal:signInPanelLabel`) | — |
|
||||
| The client's logo, a link to the site | Site settings → **Logo** (`logoField`) | the site's name |
|
||||
| The site's name, a link to the site | Site settings → **Site name** (`nameField`) | the site's host, then nothing |
|
||||
| Languages of the panel, as links | `i18n.supportedLanguages` (IAPL turns on English and Polish) | hidden with one language |
|
||||
|
||||
**Nothing is set in `.env` or in code: the logo and the name are the two fields of Site settings the public site
|
||||
uses too.** No new field, collection or global — so **no migration on Postgres / SQLite** and no change for MongoDB.
|
||||
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.
|
||||
|
||||
### Which screens
|
||||
|
||||
| Screens | How they get the look | What the project does |
|
||||
|---|---|---|
|
||||
| Login; the 2FA code, 2FA setup and "2FA setup required" screens; e-mail verification | through `AdminLogo` and `SafeTotpView` — components **already in the import map** of every site with `whiteLabel` / 2FA | nothing: an upgrade needs no edit and no `generate:importmap` |
|
||||
| Forgot password, reset password, create first user, logout, "unauthorized" | one admin provider, `SignInLook` | `whiteLabel: { signIn: { allScreens: true } }`, then `pnpm payload generate:importmap` and commit the map |
|
||||
|
||||
```ts
|
||||
iapl({
|
||||
whiteLabel: { signIn: { allScreens: true } }, // the project starter writes this for new sites
|
||||
})
|
||||
```
|
||||
|
||||
**Every sign-in screen (`allScreens`).** It adds `@intecion/ipal-kit/admin#SignInLook` to `admin.components.providers`
|
||||
— the one new import-map entry of this feature, which is why it is not on by default: a site must upgrade without
|
||||
touching its map. A provider the map lacks would render nothing, the whole panel included, so in production the
|
||||
plugin looks for the entry in `importMap.js` on disk at start and **leaves the provider out when it is not there**:
|
||||
the login and 2FA screens keep the look, and the log says `[iapl] The sign-in look covers only the login and 2FA
|
||||
screens … Run "pnpm payload generate:importmap"`. Without `allScreens` the other screens are Payload's own.
|
||||
|
||||
### Options
|
||||
|
||||
| `signIn:` | Default | Meaning |
|
||||
|---|---|---|
|
||||
| `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 |
|
||||
| `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 |
|
||||
|
||||
**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
|
||||
is signed in yet; it accepts only a language the panel supports (else `400`) and returns only to a path inside the
|
||||
admin route (taken from the `Referer`; anything else → the admin root), so it cannot be used to send someone to
|
||||
another site.
|
||||
|
||||
### What a public page may show — the security rules
|
||||
|
||||
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.
|
||||
- **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
|
||||
only as a hex colour. No script is added to the login screen. On the 2FA screens one small client component
|
||||
gives the six code boxes a name for screen readers ("Digit 2 of 6") and the numeric keyboard; it changes
|
||||
attributes only.
|
||||
|
||||
### Accessibility
|
||||
|
||||
Label and name contrast on the panel ≥ 7:1; text, links and the button on the form's side ≥ 4.5:1 in both themes;
|
||||
a visible focus ring on every control; no animation except the button's colour change, and none with
|
||||
`prefers-reduced-motion`; Windows high-contrast keeps the panel's edge; no sideways scroll from 320 px; the logo's
|
||||
alternative text is the site's name; the language links are a `<nav>` named "Language" with the current one marked
|
||||
(`aria-current`). The stylesheet and the panel come in the page's own response and are put on the page in the same
|
||||
step as the form: no flash of Payload's plain screen and no layout shift.
|
||||
A browser without `:has()` (Firefox before 121) shows Payload's plain layout.
|
||||
|
||||
### Restyle it
|
||||
|
||||
Set the custom properties on `:root` in the admin's `custom.scss` (the defaults have no specificity):
|
||||
`--iapl-signin-primary`, `--iapl-signin-primary-hover`, `--iapl-signin-primary-text`, `--iapl-signin-link`,
|
||||
`--iapl-signin-focus`, `--iapl-signin-bg`, `--iapl-signin-text`, `--iapl-signin-muted`, `--iapl-signin-border`,
|
||||
`--iapl-signin-field-border`, `--iapl-signin-panel`, `--iapl-signin-panel-text`, `--iapl-signin-panel-label`,
|
||||
`--iapl-signin-panel-glow` (three numbers, `R G B`), `--iapl-signin-panel-radius`, `--iapl-signin-panel-inset`,
|
||||
`--iapl-signin-split` (the panel's share of the width), `--iapl-signin-radius`. Classes you may rely on:
|
||||
`iapl-signin` (with `iapl-signin--logo` or `iapl-signin--name`), `iapl-signin__label`, `iapl-signin__brand`
|
||||
(`--plate`, `--name`), `iapl-signin__languages`, `iapl-credit--login`.
|
||||
|
||||
### Your own screens, or none
|
||||
|
||||
- **Off:** `whiteLabel: { signIn: false }` — Payload's screens with the plain logo; nothing else changes.
|
||||
- **Your own logo in code:** set `admin.components.graphics.Logo` yourself and do not use `whiteLabel` (the plugin's
|
||||
`Logo` wins while `whiteLabel` is on); or keep `whiteLabel` and filter what Site settings holds.
|
||||
- **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`,
|
||||
`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`.
|
||||
- **Verify:** `curl -s $URL/admin/login | grep -c 'class="iapl-signin'` → `1`; open `/admin/login` at a phone
|
||||
width; with `allScreens`, `curl -s $URL/admin/forgot | grep -c 'class="iapl-signin'` → `1`;
|
||||
`curl -si "$URL/api/ipal/admin-language?lng=xx"` → `400`.
|
||||
|
||||
## How it works
|
||||
|
||||
@@ -141,15 +254,18 @@ through `AdminIcon`.
|
||||
|
||||
- [ ] `iapl({ whiteLabel: true })`
|
||||
- [ ] The editor uploaded `logo` and `favicon` in SiteSettings (+ `siteName`)
|
||||
- [ ] `signIn: { allScreens: true }` for the look on every sign-in screen (new sites: yes)
|
||||
- [ ] `pnpm generate:importmap`
|
||||
- [ ] Restart dev / rebuild → the panel shows the client's brand on login and in the nav
|
||||
|
||||
## Turn off, override, extend
|
||||
|
||||
- **Turn off:** without `whiteLabel` (default) the panel has Payload branding; `credit: false` hides the credit;
|
||||
- **Turn off:** without `whiteLabel` (default) the panel has Payload branding; `signIn: false` keeps Payload's
|
||||
sign-in screens; `credit: false` hides the credit;
|
||||
`agency: false` removes the agency everywhere; `adminMeta: false` restores Payload's link preview.
|
||||
- **Override:** other fields / global (`settingsSlug`, `nameField`, `logoField`, `iconField`), credit text and URL,
|
||||
`titleSuffix`. With `whiteLabel` on, the plugin overrides `graphics.Logo` / `Icon` from the project
|
||||
config — set your own graphics components without `whiteLabel`.
|
||||
- **Extend:** `AdminLogo`, `AdminIcon`, `IntecionCredit` (props `agency`, `text`, `url`, `variant`) from
|
||||
`@intecion/ipal-kit/admin` can be wired manually into `admin.components` with your own `serverProps`.
|
||||
- **Extend:** `AdminLogo`, `AdminIcon`, `IntecionCredit` (props `agency`, `text`, `url`, `variant`), `SignInPanel`
|
||||
and `SignInLook` from `@intecion/ipal-kit/admin` can be wired manually into `admin.components` with your own
|
||||
`serverProps`.
|
||||
|
||||
Reference in New Issue
Block a user