HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

User Names - Can they have spaces or not?

Utter newbie using Vanilla 3.3

I currently have two installations (both are version 3.3). On one installation I can have usernames with spaces in them and according to this:

https://open.vanillaforums.com/discussion/31421/spaces-are-allowed-in-usernames

Spaces are allowed in usernames. The 4 default users (Vanilla Forums, Alex Powell etc) that come with a fresh install have spaces.

However, on one of the Vanilla installations, every time I try to add or change a username I get "Username can only contain letters, numbers, underscores, and must be between 3 and 20 characters long."

One installation was via cPanel (and oddly enough, it's the one that lets me have spaces) and one was a fresh download from here. They're both using the same version of php & MySQL

Anyone had this quirk? Tips appreciated!

Comments

  • Sorry. Now fixed.

    Used the moderation tab to create a new user (admin). Logged in to that user.

    It let me edit the username of the original admin account used for the installation. Problem solved.

    Maybe I'll leave this thread up in case there's anyone else as dense as me...

  • There is a piece of code in Vanilla which validates the user name against a pattern. You can set that pattern in the config so that it allows blanks. This is the code used:

               $defaultPattern = (unicodeRegexSupport()) ? '\p{N}\p{L}\p{M}\p{Pc}' : '\w';
    
               $validateUsernameRegex = sprintf(
                   "[%s]%s",
                   c("Garden.User.ValidationRegex", $defaultPattern),
                   c("Garden.User.ValidationLength", "{3,20}")
               );
    


    Therefore I would advise to add the following line to your /conf/config.php:

    $Configuration['Garden']['User']['ValidationRegex'] = '\p{N}\p{L}\p{M}\p{Pc} ';

Sign In or Register to comment.