Download the PHP package c10d/craft-hcaptcha without Composer
On this page you can find all versions of the php package c10d/craft-hcaptcha. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download c10d/craft-hcaptcha
More information about c10d/craft-hcaptcha
Files in c10d/craft-hcaptcha
Package craft-hcaptcha
Short Description Integrate hCaptcha validation into your forms.
License MIT
Informations about the package craft-hcaptcha
hCAPTCHA plugin for Craft CMS
Integrate hCAPTCHA validation into your forms.
Requirements
This plugin requires Craft CMS 3.4 or later.
Installation
To install the plugin, follow these instructions.
-
Open your terminal and go to your Craft project:
cd /path/to/project
-
Then tell Composer to load the plugin:
composer require c10d/craft-hcaptcha
- In the Control Panel, go to Settings → Plugins and click the “Install” button for craft-hcaptcha.
Configuring craft-hcaptcha
- Sign up for hCAPTCHA API key.
- Open the Craft admin and go to Settings → Plugins → Craft hCAPTCHA → Settings.
- Add your
site key
andsecret key
, then save. - Add the hCAPTCHA template tag and js to your forms.
Using craft-hcaptcha
In your template, just add the following twig snippet to render the hCAPTCHA iframe:
Or you can change the id of the container, and set some options:
If you're using a modal or for any reason the hcaptcha div is not in the DOM when the page is loaded, you could set a trigger when the block becomes visible (the js file should be already loaded):
You can even create the block yourself and only get the site key variable:
If you want to know what options are available, see the hCAPTCHA documentation.
NOTE: After this step is done, if you’re using the CraftCMS Contact Form plugin or you're using craft-hcaptcha to validate a public user registration, just activate the corresponding toggle in the plugin's settings, you're all set! (the hcaptcha will be automatically verified on submission)
Verify the hCAPTCHA
On the server side, you can use this to verify that the hCAPTCHA was done:
Brought to you by Cédric Givord