Reputation: 905
I add a register feature that needs unicode support for UserName
(Chinese for now). When I input Chinese UserName
, there is an error window that pops up:
User name xxxxx is invalid, can only contain letters or digits.
I search source code and do not find any validator or filter for that. I check the SQL Server schema, the UserName
type is nvarchar(32)
, which is unicode enabled.
Could anyone please tell me how to add unicode support for that field? Thanks.
Upvotes: 2
Views: 703
Reputation: 43073
This is the default behaviour of ASP.NET (Core) Identity.
You can do the following to disable validation.
IdentityRegistrar.cs:
return services.AddAbpIdentity<Tenant, User, Role>(options =>
{
options.User.AllowedUserNameCharacters = null;
})
UserManager.cs:
(UserValidator as Microsoft.AspNet.Identity.UserValidator<User, long>)
.AllowOnlyAlphanumericUserNames = false;
Upvotes: 3