Fields
Actions
Docs
Turnstile Captcha
Fields
Actions
DreamForm has built-in support for using Turnstile, a free captcha alternative provided by Cloudflare. It can be embedded into any website, even without sending traffic through Cloudflare.
Adding Turnstile
Follow the CloudFlare documentation on getting a site key & secret key. Proceed by adding the guard and the required keys to your config.php
.
// site/config/config.php
return [
'tobimori.dreamform' => [
'guards' => [
'available' => ['turnstile', /* other guards here */ ],
'turnstile' => [
'siteKey' => fn () => env('TURNSTILE_SITE_KEY'),
'secretKey' => fn () => env('TURNSTILE_SECRET_KEY')
]
],
],
];
Ideally, you should not commit these keys to your repository, but instead load it from an environment variable, e.g. using the kirby-dotenv plugin by Bruno Meilick, as shown in the example above.
Options
tobimori.dreamform.guards.turnstile. | Default | Accepts | Description |
---|---|---|---|
tobimori.dreamform.guards.turnstile. siteKey |
Default
null |
Accepts
string|callback |
The Turnstile sitekey is used to invoke Turnstile on your site |
tobimori.dreamform.guards.turnstile. secretKey |
Default
null |
Accepts
string|callable |
The Turnstile secret key allows communication between DreamForm and Cloudflare to response |
tobimori.dreamform.guards.turnstile. injectScript |
Default
true |
Accepts
boolean |
Whether the client-side script should be injected implicitly by the plugin |
tobimori.dreamform.guards.turnstile. theme |
Default
'auto' |
Accepts
'auto'|'light'|'dark' |
Theme to render the captcha with |