Fixed registering multiple users with empty e-mail

This commit is contained in:
Marcin Kurczewski 2014-09-24 23:29:47 +02:00
parent 97ca08cf44
commit ac62a44ba7

View file

@ -304,6 +304,8 @@ class UserService
private function assertNoUserWithThisEmail(\Szurubooru\Entities\User $owner, $emailToCheck) private function assertNoUserWithThisEmail(\Szurubooru\Entities\User $owner, $emailToCheck)
{ {
if (!$emailToCheck)
return;
$userWithThisEmail = $this->userDao->findByEmail($emailToCheck); $userWithThisEmail = $this->userDao->findByEmail($emailToCheck);
if ($userWithThisEmail and $userWithThisEmail->getId() !== $owner->getId()) if ($userWithThisEmail and $userWithThisEmail->getId() !== $owner->getId())
throw new \DomainException('User with this e-mail already exists.'); throw new \DomainException('User with this e-mail already exists.');