Skip to content

Commit

Permalink
Issue 484: Show correct message when user tries to register with a de…
Browse files Browse the repository at this point in the history
…leted account email

Signed-off-by: alexmerlin <[email protected]>
  • Loading branch information
alexmerlin committed Sep 30, 2024
1 parent 987ee49 commit 3d356cb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/User/src/Repository/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
use Frontend\User\Entity\UserRememberMe;
use Ramsey\Uuid\Uuid;

use function is_string;
use function strlen;

/**
* @extends EntityRepository<object>
*/
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 1 addition & 3 deletions src/User/src/Service/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 3d356cb

Please sign in to comment.