Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace OCA\User_SAML\AppInfo;

use OC\Security\CSRF\CsrfTokenManager;
use OC\User\DisabledUserException;
use OC\User\LoginException;
use OC_User;
use OCA\DAV\Events\SabrePluginAddEvent;
Expand Down Expand Up @@ -128,12 +129,14 @@ public function boot(IBootContext $context): void {
if ($request->getPathInfo() === '/apps/user_saml/saml/error') {
return;
}
/** @psalm-suppress UndefinedClass */
$targetUrl = $urlGenerator->linkToRouteAbsolute(
'user_saml.SAML.genericError',
[
'message' => $e->getMessage()
'reason' => $e instanceof DisabledUserException ? 'userDisabled' : 'authFailed',
]
);
$logger->error('Login failure', ['exception' => $e]);
header('Location: ' . $targetUrl);
exit();
}
Expand All @@ -151,7 +154,7 @@ public function boot(IBootContext $context): void {
$targetUrl = $urlGenerator->linkToRouteAbsolute(
'user_saml.SAML.genericError',
[
'message' => $l10n->t('This user account is disabled, please contact your administrator.')
'reason' => 'userDisabled',
]
);
header('Location: ' . $targetUrl);
Expand Down