While looking at the source code of a popular membership plugin, I found out that they allow changing of email ID without 'verifying' it. In fact, even WP core allows two different users to have same email ID. I'm not sure if it's by design.
The problem, I have is that when two users have the same email ID, my
get_user_by( 'email', 'email@example.com' ); function breaks. What WP does is simply look into the table and return the first user it finds in the table that has matching email ID.
Now, if I've just the email ID of the user and I want to log-them in programmatically, I'll have to write a custom function to check for all users in DB that share the email ID.
Has anyone else faced problem with email authentication? If yes, how do you uniquely identify a user with email?