浏览代码

Update User manager

Visman 3 年之前
父节点
当前提交
420a2e6f18
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. 10 2
      app/Models/User/Users.php

+ 10 - 2
app/Models/User/Users.php

@@ -105,7 +105,11 @@ class Users extends Manager
      */
     public function loadByName(string $name, bool $caseInsencytive = false): ?User
     {
-        return $this->returnUser($this->Load->loadByName($name, $caseInsencytive));
+        if ('' === $name) {
+            return null;
+        } else {
+            return $this->returnUser($this->Load->loadByName($name, $caseInsencytive));
+        }
     }
 
     /**
@@ -113,7 +117,11 @@ class Users extends Manager
      */
     public function loadByEmail(string $email): ?User
     {
-        return $this->returnUser($this->Load->loadByEmail($email));
+        if ('' === $email) {
+            return null;
+        } else {
+            return $this->returnUser($this->Load->loadByEmail($email));
+        }
     }
 
     /**