asp.net mvc的核心密码验证 [英] asp.net core mvc password validators

查看:310
本文介绍了asp.net mvc的核心密码验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是简单的方法来定制asp.net MVC核心密码验证规则?问题是完全一样的人在这里度过的如何在ASP.Net MVC 2的身份更改密码验证?的,唯一的区别是,我使用的 asp.net MVC CORE (最新版本)与Visual Studio 2015年我倒是要删除所有密码验证规则。有项目中没有 ApplicationUserManager 类,也是我不知道,如果是可以自定义的 Startup.cs 文件

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等) - 配置 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;
});

如果你想彻底改变密码验证逻辑 - 实施的 IPasswordValidator 和注册它启动。

If you want completely change password validation logic - implement IPasswordValidator and register it in Startup.

这篇关于asp.net mvc的核心密码验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆