Credits : https://gist.github.com/codebymark/ef2d12fba674035a1c89ac2ad36c81e9
I won't go into details since the installation instructions are already provided in the link above.
In config/autoload.php :
In helpers/recaptcha_helper.php :
Insert right before the closing </head>
tag on the page where you want to include the captcha. If you want to hide the captcha can uncomment the <style>
tag.
Add a hidden field to the form.
In your controller :
That's it. If you want to test you can write console.log(token);
inside the script and view it in the browser console or just leave your browser idle for a few minutes until the token expires. Then try to submit the form again without reloading the page.