Skip to content

About

Blocks spam registrations by checking name and address fields of new customer accounts against allow and deny patterns; web addresses in names are rejected by default.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Infrangible Customer Create Check

Blocks spam registrations by checking the names and addresses of new customer accounts against allow and deny patterns. Web addresses in names are rejected by default.

Behavior

Spam bots often create customer accounts with web addresses or advertising text in the name fields, which then end up in welcome emails and in the customer list. The module checks every new account before Magento creates it:

  • The names of the customer: prefix, first name, middle name, last name and suffix.
  • The fields of its addresses: the names, street, postcode, city, company, telephone and fax. This includes the address fields of the registration form and, when the account is created after a guest order, the addresses taken over from the order.
  • Accounts are checked when they are created in the storefront and through the REST, SOAP and GraphQL APIs. Accounts created in the admin are not checked.
  • Accounts that do not pass are refused with the message "We can't save the customer." The registration form keeps the entered data. The message does not say which field failed, so that spam bots cannot adjust to the patterns.

Configuration

Stores > Configuration > Infrangible Solutions > Customer Create Check has one group per field. Each has an "Allow Check" with an "Allow Pattern", which the value has to match, and a "Deny Check" with a "Deny Pattern", which the value must not match. Empty values are not checked. The settings can be changed per website and store view.

Patterns are regular expressions without delimiters, for example ^[\p{L} .'-]+$ for names made only of letters, spaces, dots, apostrophes and hyphens. They are matched in UTF-8, . also matches line breaks, and slashes need no escaping. Add (?i) at the start to ignore the case. A pattern that is no valid regular expression cannot be saved.

The preset deny pattern of the first, middle and last name rejects web addresses and domain names in any case, such as www.example.com or EXAMPLE.SHOP. Names with a dot directly followed by two to five letters, such as "St.Clair", are rejected as well; write them with a space or change the pattern.

Access to the settings needs the permission Stores > Settings > Configuration > Customer Create Check.

Requirements

  • Magento Open Source or Adobe Commerce 2.4.6 or newer
  • PHP 8.1 or newer

Installation

composer require infrangible/m2-customer-create-check
bin/magento module:enable Infrangible_CustomerCreateCheck
bin/magento setup:upgrade

In production mode, also run bin/magento setup:di:compile.

License

Infrangible Customer Create Check is licensed under the MIT License - see the LICENSE file for details.

About

Blocks spam registrations by checking name and address fields of new customer accounts against allow and deny patterns; web addresses in names are rejected by default.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages