Core: Increase username flexibility/privacy with mentions and user profile

Created on 25 Jan 2019  ·  12Comments  ·  Source: flarum/core

Feature Request

Is your feature request related to a problem? Please describe.

When you have a forum that tries to protect usernames (as they are used for logging in too) by adding the display_name (eg I've migrated that column onto the users table), the profile url and mentioning logic should be able to use that column instead of the username column.

Describe the solution you'd like
I'm pretty blocked right now and would like your input for the best solution:

  • Dispatch events on those specific controllers to allow "finding" the user.
  • Dispatch an event or allow configuration of the field to use for users (this is most likely prone to error).

Justify why this feature belongs in Flarum's core, rather than in a third-party extension

Ease of configuration and protecting user privacy. This might also relate to the PR Toby did #1721 (see point two in https://github.com/flarum/core/pull/1721#issuecomment-451306374)

Describe alternatives you've considered

🤷‍♀️

needs-discussion typfeature

Most helpful comment

If we're changing this, should we consider storing it as <@U:ID> to provide flexibility for group mentions down the line?

All 12 comments

@tobscure you might have an opinion on this as you might have already ran into this with that client, maybe I missed something that core allows here.

My feeling is that usernames should always be considered public, they are like a friendly "user ID". We could add an option to only allow logging in via email address for enhanced security?

Doesn't that complicate the idea of display- vs username? Isn't displayname supposed to be public, not the other way around? Using email as sole authorization might not be the best bet either, communities might allow multiple users with the same mail address (role playing boards for instance).

Not necessarily, the distinction is not intended to be public vs. private but just machine-friendly (something that can be used for @mentions - eg. Toby001) vs human-friendly (eg. a full name like Toby Zerner)

Using email as sole authorization might not be the best bet either, communities might allow multiple users with the same mail address (role playing boards for instance).

I don't know if we should allow this, people can always sign up multiple accounts by using + in their email address (eg. [email protected]). It's pretty commonplace that emails are unique for accounts across the internet

I think we differ in opinion where we talk about "we should allow this", in my opinion I would formulate this "we should allow this by default".

Display name really feels like something publicly usable and visible, whereas username is something that could/should be private (by default).

If username is private, how do you @mention a user? Typing their display name is not an option as it could have whitespace in it. The other option is to use their user ID (@123) but that's not very nice. (One other option is to implement a rich text editor by default which can do fancy highlighted @mentions like Facebook does them, showing the display name but storing the user ID internally, but that is very complicated and a large amount of dev work.) Hence why I think we should just keep it simple, make usernames always public, and display names are just an extra thing on top of that if you want to allow people to show their full name etc.

Let's agree to disagree 👍

To me the Facebook way of mentioning is what I had in mind. We can always revisit this later.

To me the Facebook way of mentioning is what I had in mind

Actually I agree if we were to implement that then we no longer need usernames to be public. It's just a challenging thing to implement, but we should aim for it in the long-term.

So basically, we have three things here, right?

  • Login identifier (username or email)

    • should be kept private if possible

    • username serves as fallback for display name, as that is probably optional (especially for BC)

  • Display name

    • public

    • allow as many characters as possible

    • can be used in autocompletion for mentions

  • Slug

    • for use in URLs and mention identifiers and the canonical URL (see #1901)

    • needs to be unique

    • can be amended with incrementing numbers in case of conflicts

Does this cover all the aspects mentioned here and in related issues?

According to our code, a login identifier is either a username or email address. So your summary requires specification. I personally think both of them should be kept private.

I think it'd be best to use Discord's approach, where the actual content of mentions is <@ID> but the user sees @NICKNAME#DISCRIM. In other words, the mention gets converted to a user ID reference in the DB but the user never sees it.

If we're changing this, should we consider storing it as <@U:ID> to provide flexibility for group mentions down the line?

Was this page helpful?
0 / 5 - 0 ratings