How to set a minimum username length of 6 characters for all users except administrators and staff?

Hello,

How can I set a minimum username length of 6 characters for regular users in Discourse, while allowing administrators and staff to use usernames of 3 characters? Can this be achieved with a simple JavaScript check?

Thanks in advance!

Change the minimum, set the admin username, change the minimum back. It’s not going to happen very often. If you enforced a minimum with javascript then it would be possible to bypass the check.

4 Likes

Wouldn’t that cause issues? The min username length setting advises that:

WARNING: if any existing users or groups have names shorter than this, your site will break!

4 Likes

Oh. Darn. I guess that won’t work. Maybe just having everyone use 6 letters isn’t so bad?

1 Like

We need users on the client side to be unable to enter fewer than 6 characters when filling out a form. However, administrators should be able to enter fewer characters through the admin panel. Security concerns are not important here, as we can manually fix any issues if someone bypasses this check.

If you could advise where to look in terms of JavaScript, I will try to create a theme component out of this.

Just imagine how cool it would be: limiting users in characters without breaking the system. It’s so simple, why hasn’t it been done yet?