ユーザー名の最大長さについて

In Usernames on top, lifting username length restrictions, there is a lengthy discussion about lifting the max username length restriction.

The first post gives an example of the length being increased to 40, but Usernames on top, lifting username length restrictions (post 25) says that it has been officially bumped from 15 to 20.

Is it safe to make it more than 20 characters? The reason I ask is because we’ve tied our Discourse implementation to our LDAP system for SSO, and we’re using the LDAP usernames as the Discourse usernames … and some of our users have got very long names, e.g. moorthy.baskaravenkatraman-sambamoorthy.

What is the maximum length that the system has been tested with? I don’t want to break Discourse by putting in a value that is too high …

Thanks.

「いいね!」 1

Great idea, I’ve been wondering about this myself!

Discourse has a maximum length so that other users can easily remember your username. It’s kind of like a shorthand to your actual name.

But I agree, 20 seems a little small

「いいね!」 2

@JonnyGamer You make a good point about why Discourse might have a maximum length, although you only need to start typing someone’s name and Discourse offers matches. Looking at the linked post, I think that another reason was constraints on the layout but now that full names and usernames are displayed above the post, I hope that is less of an issue than it used to be.

Hopefully one of the devs will be able to chime in :slight_smile:

「いいね!」 2

Yeah I agree, maybe closer to 30

「いいね!」 1

That is very true :ok_hand:
Except trolling people can then make multiple account very easily that are really similar to the long username.

(For exceptionally long usernames, they get truncated, so after a certain amount of letters, you can see after that. Then someone could make multiple accounts, change one character, and it all gets really confusing)


On the Hopscotch Forum, we are already getting that. Trollers are created account that are the same exact as other users, except the lowercase “L” is an uppercase “i”

llllllllll - L’s
IIIIIIII - i’s

They are super similar

This is just one example

「いいね!」 1

Yeh I once had a conversation on an alt with someone and they thought it was who the alt was impersonating until I told them.

Also telling the difference between an alt and a real person can be hard

「いいね!」 1

This would be fairly easy to fix wirh a bit of custom css, I would assume. just make the font monospace.

「いいね!」 2

Yeah, that makes sense:

III iii
lll LLL
「いいね!」 2

You mean me :joy:

「いいね!」 3

As far as I know, it is. You may see some UI breakage with extra long usernames that Discourse does not expect, though. The site setting is

max username length

and defaults to 20.

I haven’t checked the database schema to see what the absolute limit on username length as stored in the database is, though.

「いいね!」 3

I, and I am sure some other people, would think that it might be a tire to type out long usernames, even with shortcuts, if there are many similar long usernames, it could take awhile to type

「いいね!」 3

ユーザー名の最大長は、設定値がそれ以上であっても60文字のようです。

ユーザー名長を127と254に設定して試しましたが…

エンドポイント:

  • https://{{url}}/admin/groups
  • name: This_is_a_long_username_for_a_new_group_title_that_take_exactly_77_characters

レスポンス:

{
    "errors": [
        "Name is too long"
    ]
}

検証の結果、これは次に関連しています:

「いいね!」 3
cd /var/discourse/
./launcher enter app
sed -i 's/MAX_CHARS ||= 60/MAX_CHARS ||= 255/g' app/models/username_validator.rb
「いいね!」 1