diff --git a/application/Espo/Core/Utils/Api/Auth.php b/application/Espo/Core/Utils/Api/Auth.php index 4765d7efd6..09ca69f178 100644 --- a/application/Espo/Core/Utils/Api/Auth.php +++ b/application/Espo/Core/Utils/Api/Auth.php @@ -48,14 +48,21 @@ class Auth extends \Slim\Middleware $username = $authKey; $password = $authSec; - $user = $this->entityManager->getRepository('User')->findOne(array('userName' => $username)); - if ($user) { + //$user = $this->entityManager->getRepository('User')->findOne(array('userName' => $username)); + $user = $this->entityManager->getRepository('User')->findOne(array( + 'whereClause' => array( + 'userName' => $username, + ), + )); + + if ($user instanceof \Espo\Entities\User) { if ($password == $user->get('password')) { $this->container->setUser($user); $isAuthenticated = true; } } + if ($isAuthenticated) { $this->next->call(); } else { diff --git a/testAuth.php b/testAuth.php index 452cb5cd10..179563b5f8 100644 --- a/testAuth.php +++ b/testAuth.php @@ -49,15 +49,21 @@ class Auth extends \Slim\Middleware $username = $authKey; $password = $authSec; - /*$user = $this->entityManager->getRepository('User')->findOneBy(array('username' => $username)); - if ($user) { - if ($password == $user->getPassword()) { + $user = $this->entityManager->getRepository('User')->findOne(array( + 'whereClause' => array( + 'userName' => $username, + ), + )); + + if ($user instanceof \Espo\Entities\User) { + if ($password == $user->get('password')) { $this->container->setUser($user); $isAuthenticated = true; } - } */ + } + + //$isAuthenticated = true; - $isAuthenticated = true; if ($isAuthenticated) { $this->next->call();