Write a plugin to the \Magento\Customer\Api\AccountManagementInterface::authenticate() method: https://github.com/magento/magento2/blob/8fd3e8/app/code/Magento/Customer/Api/AccountManagementInterface.php#L101-L110
\Magento\Customer\Api\AccountManagementInterface::authenticate()
See also: