How to create a username having @ character using /account/registration/

Hi,

I wonder if there is a way to create users with username having a @ character? The django interface says it can be done but the api says it cant be.

At the admin the note says the following against the username field
https://********/admin/auth/user/add/:
Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.

However the API returns the following:
"user_message": "Usernames can only contain letters (A-Z, a-z), numerals (0-9), underscores (_), and hyphens (-)."

Hello @rhasan,

Yes, by default registration API will not take special characters in the username.

However, if you want to take special characters in the username then you need to add the below feature flag with true value in your settings file.

ENABLE_UNICODE_USERNAME

You can check the corresponding logic here.

But it is advisable that you should not enable this as there are some conditions in the code-base which fetch user object based on the @ identifier. Check one of the conditions.

2 Likes

oh cool. Is that possible from django admin?

No, it is not possible to enable this feature flag from the Django admin panel.

1 Like