I think my Magento 2 site has been targeted by a bot that promotes some kind of gambling website.

Luckily, my site is not yet live (I've placed "under construction" images on the header)

The bot that targets my site constantly registers fake users with seemingly stolen emails and each of their fake usernames contain the URL of a gambling website that the bot is promoting.

While I can still delete these fake users now, it will become a burden later on, and an embarassing display for legitimate users when my site finally goes live. So far, I just type "https" in the Users search list and delete everyone that has "https" in their username.

I'm wondering if there is a way for the Magento 2 user registration form to exclude / block certain keywords or patterns in usernames from registering in the site, because all the accounts that the bot created had the URL in them (https://www.example-gambling.com).

Can this be done? Is it possible for Magento 2 to prevent user registration of usernames that contains forbidden keywords?

Please let me know.

Thank you.

2 Answers 2


How about enabling captcha to prevent bots?

This way you don't need to change/update the keywords every time the hackers change the email domain


you can enable google recaptcha to secure your registration page, and secure your site from bot attack

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.