2FA back link: review fixes — views guarded by object, client views, a loud stale import map
SB-1: the 2FA package replaces a view that already stands under its keys, so a key that existed before the factory ran was wrongly treated as the project's own and left unguarded (also with a double registration, or ipalKit over its own output). Views are now compared by object, right after the factory. SB-2: SafeTotpView renders through Payload's RenderServerComponent: a client component set as a 2FA view gets only client props plus the checked back. SB-3: a production build with the previous import map shows an empty 2FA screen. twoFactor.importMapCheck (on, production only) reads the committed map at start: an error in the log and a message on the 2FA screens. Docs name the real symptom. SB-4: enabled: false restores admin.dependencies; wrapTotpViews keeps exportName. Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
93e75426ab
commit
ad51456eaa
+12
-4
@@ -30,12 +30,20 @@ once there are more than 20.
|
||||
(`@intecion/ipal-kit/admin`) are exported for projects that register the 2FA views themselves.
|
||||
- **ipal-doctor**: the import-map rule also expects `@intecion/ipal-kit/admin#SafeTotpView` when the installed
|
||||
plugin has it and the config does not set `safeBack: false`.
|
||||
- **A stale import map is reported** (`twoFactor.importMapCheck`, on by default, `false` turns it off): in
|
||||
production the plugin reads the committed `importMap.js` at start; when the entry above is missing it logs an
|
||||
error and the 2FA screens show a message instead of staying empty.
|
||||
- **A project's own 2FA screen set through the wrapped factory** (a server or a client component) is rendered
|
||||
behind the check and gets the checked `back`.
|
||||
|
||||
### Requires project changes
|
||||
- **Every site with 2FA: `pnpm payload generate:importmap`, commit `importMap.js`, `rm -rf .next`, redeploy.**
|
||||
The plugin's view now stands in front of the package's two screens and needs its import-map entry
|
||||
(`@intecion/ipal-kit/admin#SafeTotpView`). Without it the setup and verify screens fail with
|
||||
`[ipal] The admin import map has no "…"` and nobody can enter a code. No option, env, schema or migration.
|
||||
- **Every site with 2FA: `pnpm payload generate:importmap`, commit `importMap.js`, `rm -rf .next`, redeploy —
|
||||
in the same deploy as the upgrade.** The plugin's view now stands in front of the package's two screens and
|
||||
needs its import-map entry (`@intecion/ipal-kit/admin#SafeTotpView`). **If you skip this, the build still
|
||||
passes and the site starts, but the 2FA setup and verify screens come back **empty** (HTTP 200, no code form), so nobody can sign in to the panel.** There is no error page. What tells you: `pnpm exec ipal-doctor`
|
||||
before the deploy (`import map lacks …SafeTotpView`), the line `[ipal] The admin import map is out of date` in
|
||||
the log at every start, and a message on the 2FA screens instead of an empty page ("Two-step verification is
|
||||
not available"). No option, env, schema or migration.
|
||||
- **Check after deploy:** log in with the password only, open
|
||||
`/admin/verify-totp?back=https%3A%2F%2Fexample.com%2F`, enter the code → you land on `/admin`. A normal login
|
||||
still returns to the page you came from.
|
||||
|
||||
Reference in New Issue
Block a user