Username restrictions

Recently, we have moved from an old forum to discourse based forum.
The usernames on that forum were allowed to have double underscores (or multiple special characters) in the usernames.

Seems like discourse doesn’t allow those usernames. Due to this, some users are not able to login into discourse from our website using Single Sign On.
They are getting a login error.

What can be the possible solutions to this?
and
What exactly are the rules when creating a new username on Discourse? I am not able to find them anywhere.

1 Like

Err. Yes, that’s going to be complicated (EDIT: If it’s not matching on email address, which it seems not to be?).

The code you’re looking for is discourse/username_validator.rb at master · discourse/discourse · GitHub.

But what you really want to know is that there should be a custom user field with original_username if the username got changed. You should be able to get a list of them with something like this at the rails console:

 o=UserCustomField.where("name like '%orig%'")
2 Likes

Normally, SSO matches on e-mail address first if I am correct.

4 Likes

The site setting sso overrides username is set to true.

So, what happens if a user with username not following the discourse username rules try to login via Single sign on?

Also,
I think I should enable the verbose sso logging site setting, so that I can know for sure why the user is getting the error.

2 Likes

That’s the question!

That’s a good first step in finding the answer!

3 Likes