diff --git a/src/Security/UserChecker.php b/src/Security/UserChecker.php index e305e97..e37540b 100644 --- a/src/Security/UserChecker.php +++ b/src/Security/UserChecker.php @@ -27,13 +27,13 @@ class UserChecker implements UserCheckerInterface } // check if the user account is active - if (method_exists($user, 'isActive') && $user->isActive()) { + if (method_exists($user, 'isActive') && !$user->isActive()) { throw new CustomUserMessageAccountStatusException('Votre compte est désactivé.'); } //check if the user is in an organization - $uo = $this->entityManager->getRepository(UsersOrganizations::class)->findOneBy(['users' => $user, 'isDeleted' => true]); - if ($uo === null) { + $uo = $this->entityManager->getRepository(UsersOrganizations::class)->findOneBy(['users' => $user, 'isActive' => true]); + if (!$uo) { throw new CustomUserMessageAccountStatusException('Vous n\'êtes pas relié à une organisation. veuillez contacter un administrateur.'); } }