I'm using ASP.NET Core Identity (2.0) with all the default code. I changed the AccountController.Login method to check a legacy database and migrate users when a user is not found. Since that old database had both usernames and emails, I'm populating both fields in the newly created user.
But then, if I try to log in again with a migrated user, using the email doesn't work, as it seems the SQL request always look for WHERE u.NormalizedUserName = @__normalizedUserName_0 only.
How can I enable a single user with an email and a username that differ to log in with either their username or their email?
PasswordSignInAsync()but if email is used (detected by @ symbol) then an intermediate lookup for username usingFindByEmailAsync()is used.