ASP.NET MVC 5 Passwords must have at least one non letter or digit

If you are trying to register a new user, and you are getting the error below:

MVC 5 Passwords must have at least one non letter or digit

The new ASP.NET MVC 5 web templates are using the Identity framework to do the validation and password policy. This message indicates that the password policy requires a special character. In the event that our password policy does not need such requirements, we can disable this constrain.

To disable this constrain, we can follow these steps:
  • Open the identity_config.cs files under the App_start folder
  • Search for the string manager.PasswordValidator
  • We should see this code snippet:

// Configure validation logic for passwords
manager.PasswordValidator = new PasswordValidator
RequiredLength = 6,
RequireNonLetterOrDigit = true,
RequireDigit = true,
RequireLowercase = true,
RequireUppercase = true,
  • Set the RequireNonLetterOrDigit = false
  • Save and compile the application

The password requirements should now be a bit more flexible, and the error should no longer be displayed.

I hope that helps.


Post a Comment

What do you think?