在 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 密码验证器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!