Upgrade Your Drupal Skills
We trained 1,000+ Drupal Developers over the last decade.
See Advanced Courses NAH, I know EnoughHow to Use the Recaptcha Module in Drupal 8
The reCAPTCHA module for Drupal 8 integrates the reCAPTCHA service provided by Google with your Drupal site. This service provides additional protection by detecting if the user accessing your site is a real person or a robot.
Keep reading to learn how to use this module!
Step #1.- Install the Required Modules
- Open the terminal application of your PC.
- Type: composer require drupal/recaptcha
- Click Extend.
- Scroll down and enable Captcha, Image Captcha, and reCAPTCHA.
- Click Install
Step #2.- Configure the Module
- Click Configuration > CAPTCHA module settings > reCAPTCHA.
- Click the link register to reCAPTCHA.
- Select v2 of reCAPTCHA.
- Enter a valid domain name (this will not work on a local installation).
- Accept the Terms.
- Click Send / Ok.
You will get the Site Key and Secret Key. Paste them on the reCAPTCHA settings of your Drupal backend accordingly.
- Scroll down and click Save configuration.
- Click CAPTCHA Settings.
- Change the default challenge type to reCAPTCHA.
- Leave the other defaults.
- Click Save configuration.
Note: The image captcha module provides those “old-fashioned” challenges with an alphanumeric image.
- Click the Form settings tab.
- Enable the Contact Message Feedback Form.
- Click Edit.
- Add a proper name.
- Select the reCAPTCHA challenge type.
- Click Save.
Step #3.- Test the Contact Form
- Use another browser to access the site as an anonymous user.
- Navigate to yoursite/contact/feedback.
You should see the well-known “I’m not a robot checkbox”. If you click on it, you will get an image challenge to verify whether the user sending the form is human or not.
I hope you liked this tutorial. Thanks for reading!
About Drupal Sun
Drupal Sun is an Evolving Web project. It allows you to:
- Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
- Facet based on tags, author, or feed
- Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
- View the entire article text inline, or in the context of the site where it was created
See the blog post at Evolving Web