asp.net core mvc password validators(asp.net core mvc 密码验证器)
问题描述
在 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 密码验证器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:asp.net core mvc 密码验证器


基础教程推荐
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01