Users are experiencing issues with special characters like underscores and dashes being dropped from usernames during migration to Discourse, causing mismatches with their main site accounts. Kat_F reports examples such as kayakaya_ becoming kayakaya and __aena13 becoming _aena13, noting the importance of username correlation. codinghorror confirms this is due to Discourse’s built-in username rules. Falco suggests enabling new site settings that permit more characters, referencing a meta thread. Kat_F acknowledges they’ll explore this solution. mentalstring adds that SSO users also face similar conversions and questions why dashes are disallowed at username start/end, despite Unicode support allowing names like 中国. Falco advises testing custom plugin overrides before submitting a pull request. mentalstring reports partial success with leading/trailing dashes but hits a roadblock with underscores due to markdown parsing conflicts in the composer — rendering usernames in italics instead of mentions — and seeks guidance from Falco. Kat_F notes the added complexity when users choose special characters to bypass taken usernames.
On our main site there are often people who use underscores and dashes in usernames. When they are ported to our Discourse forum, one or more of those characters is often dropped from the username, resulting in a mismatch.
The forum is provided for the site users only and being able to correlate between the usernames is important.
At present we haven’t figured out how to either automatically delete or disable forum accounts when the mains are closed or at least generate a report. Is that possible?
We are seeing this too with SSO as well with usernames being converted.
I have mentioned this here, but this topic is more recent — maybe someone can take a look.
With the introduction of the Unicode support for usernames/groups, it is now possible to have usernames like 中国 (which is awesome!) but Discourse doesn’t allow usernames to start/end with a dash (but, eg, underscore is fine).
Is there a reason for preventing dashes in the first/last position? Any chance this policy can be revised if there’s no obvious downside to it? /cc @Falco
You can try overwriting those rules in a custom plugin and living with it for a few weeks. If it shows no problems in normal Discourse usage, send a pull request.
I’m having a go at this and managed to get leading/trailing dashes on usernames working fine, including on mentions.
Not so lucky with the underscore at start+end of a username because on the message composer the markdown parser seems to have precedence before the @ mentions: the username gets rendered in italic instead of a link.
I’m a bit stuck at the moment on that as I’m not sure where to look to address this. Any tip @Falco?