diff --git a/app/Services/Authenticator.php b/app/Services/Authenticator.php index c0d174895..54bec4846 100644 --- a/app/Services/Authenticator.php +++ b/app/Services/Authenticator.php @@ -49,11 +49,12 @@ public function authenticate(string $user, string $password): SimpleIdentity { $skautISUser = $this->skautIsService->getUserDetail(); - $user = $this->userRepository->findBySkautISUserId($skautISUser->ID) ?? $this->userRepository->findBySkautISPersonId($skautISUser->ID_Person); + $user = $this->userRepository->findBySkautISUserId($skautISUser->ID); $firstLogin = false; if ($user === null) { - $user = new User(); + // nacten ze skautIS pres skupinu + $user = $this->userRepository->findBySkautISPersonId($skautISUser->ID_Person) ?? new User(); $roleNonregistered = $this->roleRepository->findBySystemName(Role::NONREGISTERED); $user->addRole($roleNonregistered); $firstLogin = true;