[英]Register Fields Error Messages in ASP.Net
In the .NET framework 4.5.2, where are messages like the following in the code? 在.NET Framework 4.5.2中,代码中的以下消息在哪里?
'Passwords must have at least one non letter or digit character.'
'Passwords must have at least one uppercase ('A'-'Z').'
I know that the rules are on the class RegisterViewModel (Models/AccountViewModels.cs) and on the class ApplicationUserManager (App_Start/IdentityConfig.cs). 我知道规则是在类RegisterViewModel(Models / AccountViewModels.cs)和类ApplicationUserManager(App_Start / IdentityConfig.cs)上。
open up IdentityConfig.cs
打开
IdentityConfig.cs
navigate to the line similar to 导航到类似于
manager.PasswordValidator = new PasswordValidator
{
RequiredLength = 6,
RequireNonLetterOrDigit = true,
RequireDigit = true,
RequireLowercase = true,
RequireUppercase = true,
};
that's where it is setting the requirement. 这就是设定要求的地方。 You can alter it to meet your requirements
您可以更改它以满足您的要求
as for the location of the msg 至于味精的位置
var result = await UserManager.CreateAsync(user, model.Password);
is going to populate result object and within 将要填充结果对象和
result.Errors
are where the error msg lives. 错误消息存在的地方。 it lives inside .NET identity logic and there is no way to config it atm.
它驻留在.NET身份逻辑中,无法配置atm。 If you want to localize them you will have to do some string match and replace.
如果要本地化它们,则必须进行一些字符串匹配并替换。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.