AI Reports

Magento 2 troubleshooting › Customers

How do I find and unlock locked Magento customer accounts?

Short answer: After too many failed logins, Magento locks the account until lock_expires. List those accounts with one query and unlock them from the customer page.

Check it step by step

These queries only read data. Run them on a copy of your database if you can, or ask your developer to. If your tables have a prefix (set in app/etc/env.php), add it to each table name.

Accounts locked right now

Works on Magento Open Source and Adobe Commerce:

SELECT entity_id, email, website_id, failures_num, first_failure, lock_expires
FROM customer_entity
WHERE lock_expires > NOW()
ORDER BY lock_expires DESC;

Accounts with recent failed logins

Works on Magento Open Source and Adobe Commerce:

SELECT entity_id, email, failures_num, first_failure
FROM customer_entity
WHERE failures_num > 0
ORDER BY failures_num DESC
LIMIT 50;

Many accounts with failures at the same time can mean a credential-stuffing attack, not forgetful customers.

How to fix it

Related

Gaurav Harsh

Gaurav Harsh is a Magento developer who works on large Adobe Commerce stores and builds AI Reports, a Magento extension for asking your store's data questions in plain English. LinkedIn