Form attachments: reference smoke test with a mail sink, Turnstile reset fix, docs
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
387debc88c
commit
fdb6140c09
+5
-3
@@ -188,9 +188,10 @@ function ContactForm() {
|
||||
`reset()` → after submitting. `enabled` → false when the provider got `siteKey: null` (the widget does not
|
||||
render; server-side verification is decided by `getTurnstileConfig` anyway).
|
||||
|
||||
`reset()` only **clears `token` in React state** — it does not call `turnstile.reset()` on the
|
||||
Cloudflare widget. A new token appears only when the widget generates one again
|
||||
(e.g. after expiry, about 300 s) or is mounted again.
|
||||
`reset()` clears `token` **and makes the widget run its challenge again**, so a new token arrives a moment later
|
||||
— a token is single-use, and a form the server refused can be sent again. (Up to 1.15.5 it only cleared the
|
||||
React state, and the next send had no token until the old one expired.) Your own `<Turnstile>` outside the
|
||||
provider: change its `resetSignal` prop to get the same.
|
||||
|
||||
`useTurnstile()` outside `<TurnstileProvider>` throws. `useOptionalTurnstile()`
|
||||
(also from `/client`) returns `enabled: false` there instead of throwing — `BuilderForm` uses it.
|
||||
@@ -202,6 +203,7 @@ Cloudflare widget. A new token appears only when the widget generates one again
|
||||
| `siteKey` | `string` | — | empty → renders nothing |
|
||||
| `onToken` | `(token: string \| null) => void` | — | token once solved; `null` on expiry / error / theme change |
|
||||
| `theme` | `'page' \| 'auto' \| 'light' \| 'dark'` | `'page'` | `'page'` = the site's theme (`data-theme`, ThemeScript), no theme → `'auto'` |
|
||||
| `resetSignal` | `number` | `0` | change the value → the widget issues a new token (what `reset()` does for the provider's widget) |
|
||||
|
||||
### Why Turnstile is NOT fully "drop in and forget" like CookieBanner
|
||||
|
||||
|
||||
Reference in New Issue
Block a user