Skip to content

Commit

Permalink
chore: refine error message for restricted login
Browse files Browse the repository at this point in the history
Signed-off-by: Armin Berger <[email protected]>
  • Loading branch information
bergerar authored and Armin Berger committed Oct 29, 2024
1 parent e4e8e83 commit c8bd2e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,10 @@ public function code(string $state = '', string $code = '', string $scope = '',
$restrictLoginToGroups = $this->providerService->getSetting($providerId, ProviderService::SETTING_RESTRICT_LOGIN_TO_GROUPS, '0');
if($restrictLoginToGroups === '1') {
$syncGroups = $this->provisioningService->getSyncGroupsOfToken($providerId, $idTokenPayload);
$this->logger->debug("Prevented user from login as user is not part of a whitelisted group");

if($syncGroups === null || count($syncGroups) === 0) {
$message = $this->l10n->t('You are not allowed to login');
$this->logger->debug("Prevented user from login as user is not part of a whitelisted group");
$message = $this->l10n->t('You do not have permission to log in to this instance. If you believe this is an error, please contact an Administrator.');
return $this->build403TemplateResponse($message, Http::STATUS_FORBIDDEN, ['reason' => 'user not allowed to login']);
}
}
Expand Down

0 comments on commit c8bd2e0

Please sign in to comment.