Problem/Motivation
The \Drupal\mail_login\AuthDecorator::lookupAccount
method checks if the $identifier
is an email and, if so, only checks the email field in user queries.
This leads to a situation when users using the email address in the username (different from what's in the email field) aren't able to log in.
Steps to reproduce
1. Install the module, configure it to allow logging in with both username and email.
2. Create the user with username@test.com
as username and email@test.com
as email.
2. Log in using email@test.com
, which succeeds.
3. Log out and log in using username@test.com
.
Expected: log in successfully.
Actual: login failure.
Proposed resolution
Update the \Drupal\mail_login\AuthDecorator::lookupAccount
method to also look for email values in the username field.
Also, it may be worth adding a configuration option to configure this behavior.
Remaining tasks
Review, decide if the configuration option is needed.
User interface changes
It would become possible to log in using email stored in username field.
API changes
None.
Data model changes
None.