Ends in:
3 DAYS
22 HRS
43 MIN
56 SEC
Ends in:
3 D
22 H
43 M
56 S
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 v9.1.0-preview. Updated on December 02, 2024, 12:35