关于最大用户名长度的问题

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 个赞

据我所知,是安全的。不过,如果用户名过长,超出 Discourse 的预期,可能会导致界面显示异常。

相关站点设置项为

max username length

默认值为 20。

不过,我尚未检查数据库架构,以确认数据库中存储的用户名长度的绝对上限。

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
  • 名称: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 个赞