tugberkugurlu / AspNet.Identity.RavenDB

Fully asynchronous, new and sweet ASP.NET Identity implementation for RavenDB
MIT License
42 stars 28 forks source link

Username disallows using "-" #43

Open p10tyr opened 9 years ago

p10tyr commented 9 years ago

Why is it not allowed to use a dash "-" in the username?

   var user = new Models.ApplicationUser(userEmail);
   var result = await UserManager.CreateAsync(user, password);

Exception

Creating user Failed. User name my.name@the-gym.com is invalid, can only contain letters or digits.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Web.HttpException: Creating user Failed. User namemy.name@the-gym.com is invalid, can only contain letters or digits.

When I go into RavenDB management panel, I can change the Key manually to include the "-" and the username is just a string.

p10tyr commented 9 years ago

I checked the source code.. its not your fault.

It is the ASP UserManger causing hell. Use this line when adding a new user then will work as normal throughout the project. (You can get that username without setting the validitor, I mean.)

UserManager.UserValidator = new UserValidator<Models.ApplicationUser>(UserManager) { AllowOnlyAlphanumericUserNames = false };