Option for username not to be required to start or end with alphanumeric

AI-generated summary

NubeBuster is running a Discourse forum for a Minecraft community and has encountered an issue with username validation. The current validation rule requires usernames to start and end with alphanumeric characters, which is preventing a user with the username “SomeName_” from signing up. NubeBuster has looked into the code and found that there is no site setting to disable this feature. Heliosurge suggested making a plugin or submitting a PR to add a site setting to disable this validation rule, but noted that a PR may not be merged. NubeBuster asked if it’s possible to achieve this with a plugin by overriding the validator function, and Heliosurge believed it might be possible but recommended consulting with a more experienced plugin author. Canapin expressed interest in understanding the reason behind this validation rule and potential issues with usernames starting or ending with non-alphanumeric characters.

Hi,

I run Discourse for a Minecraft community. I require users to register from inside the game so that each user on the forums is a real Minecraft player. I’ve successfully set this up using the API of Discourse. So far great!

Now I’ve run into a problem. One user, called SomeName_ in Minecraft tried to sign up, resulting in the (Discourse produced) message:

I’ve looked in the settings and I saw no site setting that allows disabling this feature.
Looking into the code it turns out not to have a setting.

My question is, is this due to technical limitations in Discourse? Moreover, can I attempt to add a site setting to disable this and make a PR?

4 Likes

A pr may work. Though if you’re self hosted. Making a plugin likely better or in conjunction with. As a pr may or may not be merged depending on a variety of factors.

I’ve once spoken with someone about ruby. Is this doable with a plugin? I heard him mention I can override functions, such as in this case the validator. Is this correct?

Unfortunately I don’t have the experience to be able to give a definite answer. But I believe it should be possible as plugins directly alter things on the server side. One of the team or more experienced plugin authors would be best resource.

1 Like

It would be interesting to know why this rule is enforced, and if a username starting or ending with a non-alphanumeric character would cause issues.

5 Likes