fix login for names with spaces
This commit is contained in:
parent
a5c7faeff7
commit
66bd27b0ee
1 changed files with 4 additions and 1 deletions
|
@ -116,9 +116,12 @@ class User
|
|||
public static function by_name_and_pass(string $name, string $pass): ?User
|
||||
{
|
||||
$my_user = User::by_name($name);
|
||||
if (!$my_user && strpos($name, "_") !== false) {
|
||||
|
||||
// If user tried to log in as "foo bar" and failed, try "foo_bar"
|
||||
if (!$my_user && strpos($name, " ") !== false) {
|
||||
$my_user = User::by_name(str_replace(" ", "_", $name));
|
||||
}
|
||||
|
||||
if ($my_user) {
|
||||
if ($my_user->passhash == md5(strtolower($name) . $pass)) {
|
||||
log_info("core-user", "Migrating from md5 to bcrypt for $name");
|
||||
|
|
Reference in a new issue