0
PhilWynn created
Hi,
We have a requirement to use email address as User Name.
However, the User Name seems to be restricted to alpha numeric characters only, hence preventing email addresses containing hyphens.
What is the reason for this? Is it possible to override this restriction?
Many thanks.
4 Answer(s)
-
0
Hi @philwynn
If you are using ASP.NET Core, you can modify AddAbpIdentity like below;
services.AddAbpIdentity<Tenant, User, Role>(options => { // .... options.User.AllowedUserNameCharacters += @"\"; // doesn't work })
-
0
Hi,
Sorry, should have mentioned, I am using MVC, jQuery version (Abp v3.8.3)
-
1
Answered in this SO question:
<blockquote>
This is the default behaviour of ASP.NET (Core) Identity.
You can do the following to disable validation.
ASP.NET Core Identity
IdentityRegistrar.cs:
return services.AddAbpIdentity<Tenant, User, Role>(options => { options.User.AllowedUserNameCharacters = null; })
ASP.NET Identity (MVC 5)
UserManager.cs:
(UserValidator as Microsoft.AspNet.Identity.UserValidator<User, long>) .AllowOnlyAlphanumericUserNames = false;
</blockquote>
-
0
Thank you. That solved it...