Make WordPress Core

Changeset 33083


Ignore:
Timestamp:
07/04/2015 05:52:46 AM (9 years ago)
Author:
jeremyfelt
Message:

Usernames in multisite should be restricted to 60 characters or fewer.

Only 60 characters can be stored in the database for a username, which could cause lookup issues when attempting to use similar usernames of extreme length.

Props @DJPaul.
See #17904, Fixes #26784.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r32950 r33083  
    494494    if ( strlen( $user_name ) < 4 )
    495495        $errors->add('user_name',  __( 'Username must be at least 4 characters.' ) );
     496
     497    if ( strlen( $user_name ) > 60 ) {
     498        $errors->add( 'user_name', __( 'Username may not be longer than 60 characters.' ) );
     499    }
    496500
    497501    if ( strpos( $user_name, '_' ) !== false )
  • trunk/tests/phpunit/tests/multisite/wpmuValidateUserSignup.php

    r31978 r33083  
    2727            array( 'f', 'User names of 1 characters are not allowed.'  ),
    2828            array( '12345', 'User names consisting only of numbers are not allowed.'  ),
     29            array( 'thisusernamecontainsenoughcharacterstobelongerthan60characters', 'User names longer than 60 characters are not allowed.' ),
    2930        );
    3031    }
Note: See TracChangeset for help on using the changeset viewer.