How to Enable Customer Login or Register Captcha in Magento 2
Spam is every ecommerce store owner’s worst nightmare. It clouds the numbers and adds unnecessary overheads to the store processes. In many cases, if spam goes beyond a set limit, it could be a serious threat to the server resources.
To counter spam, Magento 2 store owners could use CAPTCHA at both registration and login pages for the customers. The good thing is that it is easy to add the filter at both these pages. In this tutorial, I will go over the process of enabling CAPTCHA in Magento 2 customer registration and login pages.
Open the admin panel of your store and then go to STORES → Configuration:
Next, click on Customer Configuration under the CUSTOMERS tab:
Now unfold the CAPTCHA section where you could setup the filter. Here is a short explanation of the fields in the section:
Enable CAPTCHA on Storefront: Select Yes from the drop-down menu to enable CAPTCHA.
Font: Select the font for the CAPTCHA from the list. Forms: Select the forms on which you want to show CAPTCHA.
Displaying Mode: If you want to show CAPTCHA always, select Always from the dropdown menu. If you want to show CAPTCHA after multiple attempts, select After Number of attempts to login.
Number of Unsuccessful Attempts to Login:
Enter the number of attempts after which the CAPTCHA will appear.
CAPTCHA Timeout (minutes): Enter the time after which CAPTCHA will expire, and the user has to reload the page for regenerating the CAPTCHA.
Number of Symbols: Enter the number (between 3 to 5) for the characters of the CAPTCHA. Symbols Used in CAPTCHA:
Set the symbols to be used in CAPTCHA. You can add characters (a-z or A-Z) or numbers (0-9).
Case Sensitive: Select Yes from the drop-down menu, if you wish CAPTCHA to be case sensitive.
When you are done, click the Save Config button:
CAPTCHA is a great way of stopping spam from skewing the store statistics. In particular, after reading this tutorial, you could easily setup CAPTCHA at the customer registration and login pages of Magento 2. If you have any query related to this topic, just use the comment box below!
Syed Muneeb Ul Hasan is a Magento Developer and Blogger at Magenticians – a platform to learn Magento. He is an expert in PHP and Magento and prefers to educate users in the implementation of Magento. When not working, he loves to play games and watch cricket. You can follow him on Twitter.