From 1d6da9b14d2c86aba38f30a3ad601ab571cbe85a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Noack?= <noack@data-quest.de> Date: Wed, 8 Jan 2025 09:04:57 +0000 Subject: [PATCH] =?UTF-8?q?Resolve=20#5099=20"PHP-Fehler=20beim=20Login=20?= =?UTF-8?q?=C3=BCber=20SSO,=20wenn=20das=20auth=5Fplugin=20nicht=20=C3=BCb?= =?UTF-8?q?ereinstimmt"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #5099 Merge request studip/studip!3815 --- lib/authentication/Manager.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/authentication/Manager.php b/lib/authentication/Manager.php index b25efadf9d0..639be660cb2 100644 --- a/lib/authentication/Manager.php +++ b/lib/authentication/Manager.php @@ -13,11 +13,14 @@ namespace Studip\Authentication; use AccessDeniedException; use Config; +use MessageBox; use Metrics; +use PageLayout; use Request; use Seminar_Perm; use Seminar_User; use StudipAuthAbstract; +use StudipAuthSSO; use StudipMail; use Token; use User; @@ -55,10 +58,9 @@ class Manager Metrics::increment('core.sso_login.attempted'); // then do login $authplugin = StudipAuthAbstract::GetInstance($provider); - if ($authplugin instanceof \StudipAuthSSO) { - $authplugin->authenticateUser('', ''); - if ($authplugin->getUser()) { - $user = $authplugin->getStudipUser($authplugin->getUser()); + if ($authplugin instanceof StudipAuthSSO) { + $user = $authplugin->authenticateUser('', ''); + if ($user) { if ($user->isExpired()) { throw new AccessDeniedException( _('Dieses Benutzerkonto ist abgelaufen. Wenden Sie sich bitte an die Administration.') @@ -73,6 +75,12 @@ class Manager $this->setAuthenticatedUser($user); sess()->regenerateId(['auth', '_language', 'phpCAS', 'contrast']); + } else { + PageLayout::postMessage( + MessageBox::error($authplugin->plugin_name . ': ' . _('Login fehlgeschlagen'), + $authplugin->error_msg ? [$authplugin->error_msg] : []), + md5($authplugin->error_msg) + ); } } } -- GitLab