getgrav / grav-plugin-login

Grav Login Plugin
http://getgrav.org
MIT License
44 stars 54 forks source link

Activation Problem #146

Closed ivan86to closed 4 years ago

ivan86to commented 6 years ago

When i use a capitalized username, the activation process not work. What is the problem? Hosting in OVH shared server Tnk!

ivan86to commented 6 years ago

I found the problem..

in User.php there is a method to load User.

public static function load($username)
{
    $grav = Grav::instance();
    /** @var UniformResourceLocator $locator */
    $locator = $grav['locator'];

    // force lowercase of username

I have commented this row.. -> $username = strtolower($username);

    $blueprints = new Blueprints;
    $blueprint = $blueprints->get('user/account');

    $file_path = $locator->findResource('account://' . $username . YAML_EXT);
    $file = CompiledYamlFile::instance($file_path);
    $content = (array)$file->content() + ['username' => $username, 'state' => 'enabled'];

    $user = new User($content, $blueprint);
    $user->file($file);

    return $user;
}
rhukster commented 5 years ago

sorry for the late reply.. cleaning house!

How are you adding the usernames with mixed case? They should be lower case when created.

I tested with CLI and with Registration form and got the same response from both:

Enter a username: BobbyJones
 Username should be between 3 and 16 characters, including lowercase letters, numbers, underscores, and hyphens. Uppercase letters, spaces, and special characters are not allowed