Search code examples
authenticationasp.net-mvc-5asp.net-identity-2

How to login using UserName or Email in ASP.NET in Identity 2?


I'm writing an ASP.NET MVC 5 application, the application scafolded an authentication but the login only authenticates/logins users using the UserName. How to edit the login method to accept either email or username?


Solution

  • It's as simple as making the UserName and Email the same. As in store the Email in the UserName field.