0

I'm trying to implement ASP.Net Identity into existing ASP.Net MVC and Web API applications. However, normal users should be registered using email adresses and administrators should be registered using usernames.

How can I have it this way?

juliano.net
  • 7,982
  • 13
  • 70
  • 164

1 Answers1

0

The simplest way, and I am assuming you mean with locally registered users, not registered with an external identity provider, would be to have separate registration pages for the two different user types. On that page for regular users, only ask for email address, and set the username to the value of the email field when you create the user. On the admin registration, keep the fields separate, perhaps even validating that they are not the same. Finally you will have a Register link for each user type, pointing to the correct page. A variation is using the same page with a parameter that tells you which flavor you want and shows/hides fields as needed.

Philip Nelson
  • 985
  • 6
  • 20
  • Actually for normal users they can log in using their email and password or via Facebook login. I've created a separate project for the admin panel, so the login state won't be shared. Maybe it will make things easier. – juliano.net Aug 25 '14 at 16:28