Hello everybody! In this article, we will discuss the constant registration of bots and methods of their fight.
A reliable method is to use CAPTCHA, but it is not always user-friendly and can complicate the registration process. Based on my research on the behavior of bots, I have developed several improvements that will help you reduce or completely stop the registration of accounts by bots.
First, we need to understand the patterns by which fictitious accounts are registered. I have identified two main patterns:
-
The first and last names always have camel notation and contain three or more capital letters. Usually there is only one capital letter in the first and last name, but sometimes they may be missing.
Sometimes registration takes place with the same first and last name, which is unusual for ordinary users.
Let's start writing our improvements to combat bots. First of all, we need to add a check for the presence of three or more capital letters in the first and last names. To do this, we will use the class Validate.php and the isCustomerName method. This method is responsible for checking the first and last name. We will redefine it in the file override/classes/Validate.php and replace it with a new one.
In this method, we use a regular expression to determine the number of capital letters in the first and last name.
Next, we need to determine the similarity of the first and last names. First, we will create a module to be able to manage and capture the moment of registration of a bot or user. The module can be generated here and install it.
In the install() method of the module, add the hook $this->registerHook('actionSubmitAccountBefore') and restart the module to register our hook.
It remains to define the method in the module class and perform a first and last name comparison. If they are the same, we will display an error and will not allow the user or the bot to complete the registration.
It's all. If you want me to do this for you on your website, write in a chat or use another convenient method of communication.
Leave a comment on whether you managed to do it or not.