Open Closed

How to allow special characters in UserName and Email for user registration #5275


User avatar
0
bhasinp created
  • ABP Framework version: v5.1.3
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes / no
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

Hi Team,

I would like to allow some special characters in username and email of identity user.

Can you please guide me how can I achieve this.

Currently I'm getting this error "Username 'pankaj.bhasin-O'mail@initto.ca' is invalid, can only contain letters or digits." (this is the test email sample and error which I'm getting, I would like to allow -' and other special characters in UserName and Email)

Thanks


2 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    You can try:

    Configure<IdentityOptions>(options=>
    {
        options.User.AllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._@'+";
    });
    

  • User Avatar
    0
    bhasinp created

    Thanks Team, This works well.

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11