asp.net-mvc – 如何在MVC6或AspNet Core或IdentityCore中更改Pa
发布时间:2020-12-15 20:10:23 所属栏目:asp.Net 来源:网络整理
导读:在使用Identity的Asp.Net MVC 5中,可以执行以下操作: manager.PasswordValidator = new PasswordValidator { RequiredLength = 6,RequireLowercase = true,RequireDigit = false,RequireUppercase = false }; 如何在MVC 6中更改相同的配置? 我看到可以在段
在使用Identity的Asp.Net MVC 5中,可以执行以下操作:
manager.PasswordValidator = new PasswordValidator { RequiredLength = 6,RequireLowercase = true,RequireDigit = false,RequireUppercase = false }; 如何在MVC 6中更改相同的配置? 我看到可以在段中的ConfigurationServices方法中: services.AddIdentity<ApplicationUser,IdentityRole>() .AddPasswordValidator<>() 但我无法使用. 解决方法
解决方案Beta6
在Startup.cs中编写代码: services.ConfigureIdentity(options => { options.Password.RequireDigit = false; options.Password.RequiredLength = 6; options.Password.RequireLowercase = false; options.Password.RequireNonLetterOrDigit = false; options.Password.RequireUppercase = false; }); 更新Beta8和RC1 // Add Identity services to the 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(); 更新RC2 // Add Identity services to the 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(); (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 制作ASP.Net Web表单的“模式”是什么?
- asp.net-mvc – 通过Web Api接收,发送文件
- asp.net-mvc-2 – ASP.NET MVC数据注释客户端验证与继承的R
- asp.net-mvc – 多次调用Action方法
- asp.net-mvc – asp.net mvc url action忽略旧参数值
- asp.net – Internet Explorer嵌套表单帖子
- asp.net-core – ASP.NET核心查找所有程序集中的所有类类型
- asp.net-mvc – 会员提供商中的GetAllUsers在哪里?
- asp.net – SQL – 两个不同长度的字符串之间的相似性
- 通过几个Hello World感受.NET Core全新的开发体验