diff --git a/src/User/src/Repository/UserRepository.php b/src/User/src/Repository/UserRepository.php index 2bf5ebf..697e3b4 100644 --- a/src/User/src/Repository/UserRepository.php +++ b/src/User/src/Repository/UserRepository.php @@ -13,6 +13,9 @@ use Frontend\User\Entity\UserRememberMe; use Ramsey\Uuid\Uuid; +use function is_string; +use function strlen; + /** * @extends EntityRepository */ @@ -50,9 +53,8 @@ public function exists(string $email = '', ?string $uuid = ''): ?User $qb->select('user') ->from(User::class, 'user') - ->where('user.identity = :email')->setParameter('email', $email) - ->andWhere('user.isDeleted = :isDeleted')->setParameter('isDeleted', User::IS_DELETED_NO); - if (! empty($uuid)) { + ->where('user.identity = :email')->setParameter('email', $email); + if (is_string($uuid) && strlen($uuid) > 0) { $uuid = Uuid::fromString($uuid)->getBytes(); $qb->andWhere('user.uuid != :uuid')->setParameter('uuid', $uuid); } diff --git a/src/User/src/Service/UserService.php b/src/User/src/Service/UserService.php index 2f853f9..b32d79c 100644 --- a/src/User/src/Service/UserService.php +++ b/src/User/src/Service/UserService.php @@ -250,9 +250,7 @@ public function deleteAvatarFile(string $path): bool public function exists(string $email = '', ?string $uuid = ''): bool { - return ! empty( - $this->userRepository->exists($email, $uuid) - ); + return $this->userRepository->exists($email, $uuid) instanceof User; } /**