【发布时间】:2016-02-05 10:07:11
【问题描述】:
我要做的只是在 .NET MVC 6 / vNext 注册过程中允许字母数字字符,并且我见过的每个教程(即Configure Microsoft.AspNet.Identity to allow email address as username)都引用UserManager.UserValidator,其中现在不可用当前框架。
我已经看到了这个:UserValidator in Microsoft.AspNet.Identity vnext 这看起来和我的问题一样,但他们已经将UserNameValidationRegex 属性从框架中移除了。太棒了。
services.AddIdentity<ApplicationUser, IdentityRole>(
o => {
o.Password.RequireDigit = false;
o.Password.RequireLowercase = false;
o.Password.RequireUppercase = false;
o.Password.RequireNonLetterOrDigit = false;
o.Password.RequiredLength = 2;
//o.User.AllowedUserNameCharacters here seems to be the only logical thing I can access
})
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
我找到了o.User.AllowedUserNameCharacters,但是没有找到关于此的文档,我不知道我必须将其设置为什么格式?有谁在同一条船上解决了这个问题?
提前致谢。
【问题讨论】:
标签: c# asp.net .net asp.net-mvc asp.net-core