Emoji in Username
-
I have a custom Auth system connected to NodeBB, which allows Emoji to be used within the username. This is causing problems when it tries to create the matching account within the forum.
I have nodebb-plugin-emoji-extended enabled.
Is there any way to allow Emoji within the username field?
Cheers.
-
@snodejoke said in Emoji in Username:
orum.
It's like a funny story, as many of the companies started to write emojis instead of letters do decorate their slogan or websites.
But I don't think using emojis as username is a good idea. -
Usernames aren't limited to ASCII, as you can also register Chinese usernames (for instance, try ä½ å¥½ ). I suppose it's possible to register usernames containing emoji unicode characters (). However, these usernames cannot be registered. The form disallows the use of these characters, and maybe there are also server-sided checks. In order to allow these characters, removing the checks (unsafe) or adding emoji characters to the checks (safe) from the source code would suffice.
But keep in mind that the character is different than , as the first one is unicode and the second one an image. Whatever emoji you want to use, it will have a unicode equivalent.
-
@JasperNL said in Emoji in Username:
Usernames aren't limited to ASCII, as you can also register Chinese usernames (for instance, try ä½ å¥½ ). I suppose it's possible to register usernames containing emoji unicode characters (). However, these usernames cannot be registered. The form disallows the use of these characters, and maybe there are also server-sided checks. In order to allow these characters, removing the checks (unsafe) or adding emoji characters to the checks (safe) from the source code would suffice.
But keep in mind that the character is different than , as the first one is unicode and the second one an image. Whatever emoji you want to use, it will have a unicode equivalent.
You can start with tweaking the client-sided script:
https://github.com/NodeBB/NodeBB/blob/master/public/src/client/register.jsThe function you will need to tweak is validateUsername. The problem with unicode emoji appears to be that utils.slugify does not seem to allow those characters. I think it's best to start with tweaking utils.slugify. You can find that in this file, line 77.
https://github.com/NodeBB/NodeBB/blob/master/public/src/utils.js -
Thank you for the insightful analysis @JasperNL
If a PR is made to update the server-side checks to allow the unicode range for emoji (and just this range), that will likely be merged. I do not see an issue with allowing it.
We do want to blacklist other ranges that could potentially be troublesome, like zero-width spaces, etc...