Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Username with non-english characters

edited December 2011 in Vanilla 2.0 - 2.8

I use Version 2.1a4 and users can't enter latin characters like ç-é-ö-ş for their username.
The other discussions about this topic is a bit dated so I wonder if anybody found a solution for this.

I know that I have to define this as Regex (/^([a-zA-Z\s\ö\ç\ş\ı\ğ\ü\Ö\Ç\Ş\İ\Ğ\Ü]+)$/)

I tried it on config.php and functions.validation.php files and it didn't make any change.

Best Answer

  • ToddTodd Vanilla Staff
    Answer ✓

    You are using some damn bleeding edge code there.

    I've defined a minimal username regex constant in the usermodel that should work for your purposes{

    const USERNAME_REGEX_MIN = '^\/"\\\\#@\t\r\n';
    

    The code that grabs the config value is quite a bit quirky. It adds square brackets and other stuff around the config value.

Answers

  • ToddTodd Vanilla Staff
    Answer ✓

    You are using some damn bleeding edge code there.

    I've defined a minimal username regex constant in the usermodel that should work for your purposes{

    const USERNAME_REGEX_MIN = '^\/"\\\\#@\t\r\n';
    

    The code that grabs the config value is quite a bit quirky. It adds square brackets and other stuff around the config value.

  • Thanks. I've tried this alternative but couldn't get it to work. Could you please see if this looks right to you?

    const USERNAME_REGEX_MIN = '^\/"\\\\#@\t\r\n\ö\ç\ş\ı\ğ\ü\Ö\Ç\Ş\İ\Ğ\Ü';

  • ToddTodd Vanilla Staff

    Figuring out regex on sight is not one of my strong suits. When I came up with my regex above I copied ValidateUsername() from functions.validate.php to a test file and just kept retrying until it worked. I recommend that path.

Sign In or Register to comment.