diff --git a/app/Models/User.php b/app/Models/User.php index 737b66a56e6..dcee75bbedc 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2128,8 +2128,10 @@ public static function attemptLogin($user, $password, $ip = null) public static function findForLogin($username, $allowEmail = false) { - if (!present($username)) { - return; + $username = trim($username ?? ''); + + if ($username === null) { + return null; } $query = static::where('username', $username);