asp.net mvc - How to change PasswordValidator in MVC6 or AspNet Core or IdentityCore -
in asp.net mvc 5 using identity, possible following:
manager.passwordvalidator = new passwordvalidator { requiredlength = 6, requirelowercase = true, requiredigit = false, requireuppercase = false };
how change same configuration in mvc 6?
i see can in configurationservices method in segment:
services.addidentity<applicationuser, identityrole>() .addpasswordvalidator<>()
but not use.
the solution beta6
in startup.cs
write code:
services.configureidentity(options => { options.password.requiredigit = false; options.password.requiredlength = 6; options.password.requirelowercase = false; options.password.requirenonletterordigit = false; options.password.requireuppercase = false; });
update beta8 , rc1
// add identity services services container. services.addidentity<applicationuser, identityrole>(options => { options.password.requiredigit = false; options.password.requiredlength = 6; options.password.requirelowercase = false; options.password.requirenonletterordigit = false; options.password.requireuppercase = false; }) .addentityframeworkstores<applicationdbcontext>() .adddefaulttokenproviders();
update rc2
// add identity services services container. services.addidentity<applicationuser, identityrole>(options => { options.password.requiredigit = false; options.password.requiredlength = 6; options.password.requirelowercase = false; options.password.requirenonalphanumeric= false; options.password.requireuppercase = false; }) .addentityframeworkstores<applicationdbcontext>() .adddefaulttokenproviders();
Comments
Post a Comment