0

I want to change the password requirements for my registration form but I cant find the PasswordValidator property in the UserManager class.

I'm using AspNet.Identity.EntityFramework 3.0.0-beta5

private readonly UserManager<AppUser> _userManager;
        private readonly SignInManager<AppUser> _signInManager;

        public AccountController(UserManager<AppUser> userManager, SignInManager<AppUser> signInManager)
        {

            _userManager = userManager;
            _signInManager = signInManager;

            // UserManager does not contain a definition for PasswordValidator
            //_userManager.PasswordValidator

        }

(For comparison, in Microsoft ASP.NET Identity 2.0, documentation for UserManager<TUser, TKey>.PasswordValidator is here.)

dbc
  • 104,963
  • 20
  • 228
  • 340
user3621898
  • 589
  • 5
  • 24

1 Answers1

0

So I managed to fix it by changing the identity options in my startup.cs

This is what it looked like before

    services.AddIdentity<Models.Identity.AppUser, IdentityRole>()
       .AddEntityFrameworkStores<test.Models.Identity.IdentityDataContext>();

This is what it looks like now

services.AddIdentity<Models.Identity.AppUser, IdentityRole>(options =>
            {
                options.Password.RequireDigit = false;
                options.Password.RequiredLength = 6;
                options.Password.RequireLowercase = false;
                options.Password.RequireNonLetterOrDigit = false;
                options.Password.RequireUppercase = false;
            })
                .AddEntityFrameworkStores<test.Models.Identity.IdentityDataContext>();
user3621898
  • 589
  • 5
  • 24