Friendly Captcha ook voor de SLP-site: gedeelde widget in formulier B en het terminalformulier van E
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
+2
@@ -18,3 +18,5 @@ Facts and risks:
|
||||
- Per-visitor rate limiting works only if Pi-Entry passes `X-Forwarded-For`/`-Proto` (not verified) and KnownProxies contains 192.168.1.102.
|
||||
- nginx on Pi-Main is not in the path; security headers come from the app. Whether Pi-Entry adds its own CSP/headers is unknown.
|
||||
- Announce any REQUIRED new variable in advance: a missing required variable caused a crashloop on ASF on 2026-11-08 (App__PublicBaseUrl). The contact variables are optional (module off by default).
|
||||
|
||||
- SLP captcha (U7, 2026-11-11): the SLP site renders the Friendly Captcha widget (shared lazy chunk) in design B and the E terminal form. `frame-src` (global, global0, global1 .frcapi.com) must be allowed where the SLP site HTML is served; which server that is has NOT been confirmed (Pi-Main: nginx not in path; Pi-Entry unknown). Captcha stays off in production (`Contact__Captcha__Enabled=false`) until a paid plan.
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
# Code Generation Plan — captcha-slp (U7: Friendly Captcha for the SLP site, B and E)
|
||||
|
||||
Reason: Bryan wants SLP to support the captcha like ASF (2026-11-11). Until now the SLP form falls back to the mail button when the token response carries `captcha`. Production keeps captcha OFF (server `Contact__Captcha__Enabled=false`) until a paid Friendly Captcha plan exists; this unit makes the SLP site able to use it. Base: ASF's tested `CaptchaWidget` (read only) and the cms-client slot (93fa729).
|
||||
|
||||
## Steps
|
||||
- [x] 1. **Dependency**: add `@friendlycaptcha/sdk` 1.1.3 (pinned; check pnpm `minimumReleaseAge`, `pnpm audit --prod` stays clean).
|
||||
- [x] 2. **Shared widget** `src/shared/contact/CaptchaWidget.tsx` (framework-neutral styling, Tailwind): lazy SDK import (own chunk), `startMode: focus`, `language: nl`, `apiEndpoint` from the server, `onToken(token|null)` on complete/expire/error, `onProblem(boolean)` (error, blocked script/iframe, no sign of life within 15 s), `resetCount` resets the widget and clears the token, `destroy()` on unmount, reserved height (no layout shift), `theme` prop (`light|dark`), `aria` friendly label; loaded only when the form is open AND the server asks for a captcha.
|
||||
- [x] 3. **Availability** `useContactAvailability`: `captcha != null` with provider `friendlycaptcha` opens the form (other providers keep the mail button).
|
||||
- [x] 4. **Form B** `ContactFormView`: render the widget (Suspense, reserved height), wire `setCaptchaToken`, `captchaResetCount`; widget problem => clear message with the mail button (never silently blocked); `captchaRequired` message (role alert) from the package.
|
||||
- [x] 5. **Form E** `TerminalForm`: same wiring in terminal style (widget theme dark, amber frame), messages in terminal casing.
|
||||
- [x] 6. **Tests**: fake SDK (complete, expire, error, no sign of life, reset after attempt); B and E: widget only when captcha required, expired token never sent, submit blocked with message until solved, problem => mail button, captcha provider unknown => mail button, no widget chunk when no captcha.
|
||||
- [x] 7. **Quality gates**: lint, tests, build (new lazy chunk size noted; main bundle must not grow), `pnpm audit --prod`.
|
||||
- [x] 8. **Docs + infra note**: update code summary and `operations/host-config-checklist.md`: frame-src for the three hosts must be set where the SLP site HTML is served (not yet confirmed which server that is); captcha stays off in production until a paid plan.
|
||||
- [x] 9. **Commit, push, test-deploy** (deploy_test only). Real-browser run with the widget against the local SLP API (5290, captcha on) as Bryan's check.
|
||||
|
||||
## Not in this unit
|
||||
Enabling captcha in production, paid plan, EU switch (config only), privacy page for SLP (separate), CSP on the host that serves slpsoftware.nl (needs confirmation from the infra owner).
|
||||
Reference in New Issue
Block a user