Hi guys, I made a project, where the admin can add users and manage them. I added the FirstName and LastName column for it and made the UserName to be choosen by the admin, not to be the email also as username. I followed this tutorial to do so http://marcinjuraszek.com/2014/03/asp-net-identity-2-0-0-username-and-email-separation.html except I made my own ViewModel for the users that get added by the admin, and I'm using my custom ViewModel to create and edit users, also my own controller class with the actions for it and everything works well. But in the tutorial it said:
"Login page
Everything seems to work fine, but when you try to log with changes like that, you’ll find out it’s not possible. That’s because although login page requires an email address to log in it actually uses
model.UserName
to validate provided email. With our changesmodel.UserName
does not contain email anymore. But that problem can be fixed easily."
and to make it work we change the LoginViewModel class and instead the Email property we use the Username property. Why is that so (why does it use the UserName for login even while it says it's using the Email property), where is that rule being setup and where/how can I change it? (This is some extra information I want to know to get familiar with Asp.Net MVC 5 Authentication system.)
The main question is: How can I make the login to work with either email or username like in facebook? (There was a link in the tutorial for it "ASP.NET Identity 2.0 – Logging in with Email or Username" but the page gets a 404). Please help me and thank you in advance.