ASP.NET身份,都需要“强”密码 [英] ASP.NET Identity, require 'strong' passwords

查看:101
本文介绍了ASP.NET身份,都需要“强”密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

也许我的googlin今天早上技能是没有那么大,但我似乎无法找到如何使用单个用户帐户设置不同的密码要求(而非最小/最大长度)一个新的asp.net mvc5项目

Perhaps my googlin' skills are not so great this morning, but I can't seem to find how to set up different password requirements (rather than min/max length) with a new asp.net mvc5 project using individual user accounts.

[Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }

我不知道我想要什么密码要求做的,只是还没有,但有可能最小长度的组合,需要一个小写,在大写字母和一个数字。

I don't know what password requirements I want to do just yet, but likely a combination of min length and requiring one lowercase, on capital letter, and a number.

任何想法,我怎么能做到这一点(通过模​​型属性preferably)?

Any idea how I can accomplish this (via model attributes preferably)?

推荐答案

您可以使用 RegularEx pressionAttribute 从这个答案的规则在一起:

You could use the RegularExpressionAttribute together with the rules from this answer:

的正则表达式密码强度

这篇关于ASP.NET身份,都需要“强”密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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