问题描述
在 asp.net core MVC 中自定义密码验证规则的简单方法是什么?这个问题就像有人在这里遇到的一样 如何在 ASP.Net MVC Identity 2 中更改密码验证? 唯一的区别是我在 Visual Studio 2015 中使用 asp.net CORE MVC(最新版本).我'想删除所有密码验证规则.项目中没有ApplicationUserManager类,也不确定是否可以在Startup.cs文件中自定义UserManager验证规则.
What is the easy way to customize password validation rules in asp.net core MVC? The problem is exactly like someone had here How To Change Password Validation in ASP.Net MVC Identity 2? the only difference is that I'm using asp.net CORE MVC (latest build) with Visual Studio 2015. I'd like to remove all password validation rules. There is no ApplicationUserManager class in the project, also I'm not sure if it's possible to customize UserManager validation rules in the Startup.cs file.
推荐答案
如果你想简单地禁用一些密码限制(RequireLowercase、RequiredLength 等) - 在 Startup 中配置 IdentityOptions.Password,如下所示:
If you want simply disable some password restrictions (RequireLowercase, RequiredLength etc) - configure IdentityOptions.Password in Startup, like this:
services.Configure<IdentityOptions>(o =>
{
o.Password.RequiredLength = 12;
});
如果你想彻底改变密码验证逻辑 - 实现 IPPasswordValidator 并在 Startup 中注册.
If you want completely change password validation logic - implement IPasswordValidator and register it in Startup.
这篇关于asp.net core mvc 密码验证器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)