nodebb-plugin-sso-google Remove the dash in username
-
If my google username is
bla blaa
, while registering a user with this plugin it assigns the usernamebla-blaa
to my nodebb user. So if my forum is example.com , my username becomes @[email protected] . While this username can be followed from most fediverse server like mastodon and pixelfed, threads takes only the part before the dash and so assumes the username to bebla
and thus the nodebb user cannot be mentioned or followed from threads. So, I want this plugin to assign the username @[email protected] or @[email protected] on registration for this case. @julian @baris How can I do so? Asking this because I did not find any code in this plugin which concatenates the username parts using dash, so I guess this has got to do something with core nodebb and this plugin will need to override that. -
@bh4-tech let me ask the Threads people about this. Seems like an odd omission.
-
@julian Have attached the link to the specific post here.
-
@bh4-tech hmm, looks like it's related to how Threads is processing the mention. They're not capturing the dash, so it could be the remote account still exists.
-
@julian The mastodon and pixelfed profile mentions work fine. I am attaching the screenshot of what opens when I click on the pixelfed profile link.
-
@bh4-tech interesting, since they don't look linked to me. However I don't have a Threads account, so I'm not logged in.
Can you screenshot your post?
-
@julian I guess it's not linked since you don't have account on threads. The screenshot is attached.
-
@bh4-tech can you test with another account with a dash? I wonder if it's capturing the
bh4
because there is an Instagram account with that handle. -
Also you know what it could be, is that this site is blocked by Threads, so that's why the link might not match.
-
@julian community.nodebb.org is blocked by threads but my nodebb instance isn't . For my nodebb server also, usernames with dash cannot be mentioned while others can be(screenshot attached).
Also, a dash in username doesn't look nice and we do not have much control over remote servers(like threads). So, please suggest me a way in which new users can be created with google-sso plugin without a dash.
-
@bh4-tech you will have to modify src/slugify.js so that the generated slug contains no dashes.
-
@julian Thanks, will try and let you know.
-
@julian src/slugify.js requires public/src/modules/slugify, so I changes the slugify function in that file to
return function slugify(str, preserveCase) { if (!str) { return ''; } str = String(str).replace(trimRegex, ''); if (isLatin.test(str)) { str = str.replace(invalidLatinChars, '_'); } else { str = XRegExp.replace(str, invalidUnicodeChars, '_'); } str = !preserveCase ? str.toLocaleLowerCase() : str; str = str.replace(collapseWhitespace, '_'); str = str.replace(collapseDash, '_'); str = str.replace(trimTrailingDash, ''); str = str.replace(trimLeadingDash, ''); return str; };
, basically replaced the dashes with underscore. I then stopped my current instance, upgraded it and then started it. However, now I registered a user using the google-sso plugin and again it has a dash in username instead of underscore. I guess we need to log the username somewhere in the plugin/core nodebb to find the problem. Which would be the best place for doing so?
-
@bh4-tech My editing was correct but there was some problem with git on my server. I have fixed the things and now google registered users are having underscore in username instead of dash and can also be followed and mentioned from threads.
@julian The problem is solved and thanks a lot for the support.