Skip to content
Snippets Groups Projects
Commit 1d6da9b1 authored by André Noack's avatar André Noack
Browse files

Resolve #5099 "PHP-Fehler beim Login über SSO, wenn das auth_plugin nicht übereinstimmt"

Closes #5099

Merge request studip/studip!3815
parent 5bf6eefb
No related branches found
No related tags found
No related merge requests found
...@@ -13,11 +13,14 @@ namespace Studip\Authentication; ...@@ -13,11 +13,14 @@ namespace Studip\Authentication;
use AccessDeniedException; use AccessDeniedException;
use Config; use Config;
use MessageBox;
use Metrics; use Metrics;
use PageLayout;
use Request; use Request;
use Seminar_Perm; use Seminar_Perm;
use Seminar_User; use Seminar_User;
use StudipAuthAbstract; use StudipAuthAbstract;
use StudipAuthSSO;
use StudipMail; use StudipMail;
use Token; use Token;
use User; use User;
...@@ -55,10 +58,9 @@ class Manager ...@@ -55,10 +58,9 @@ class Manager
Metrics::increment('core.sso_login.attempted'); Metrics::increment('core.sso_login.attempted');
// then do login // then do login
$authplugin = StudipAuthAbstract::GetInstance($provider); $authplugin = StudipAuthAbstract::GetInstance($provider);
if ($authplugin instanceof \StudipAuthSSO) { if ($authplugin instanceof StudipAuthSSO) {
$authplugin->authenticateUser('', ''); $user = $authplugin->authenticateUser('', '');
if ($authplugin->getUser()) { if ($user) {
$user = $authplugin->getStudipUser($authplugin->getUser());
if ($user->isExpired()) { if ($user->isExpired()) {
throw new AccessDeniedException( throw new AccessDeniedException(
_('Dieses Benutzerkonto ist abgelaufen. Wenden Sie sich bitte an die Administration.') _('Dieses Benutzerkonto ist abgelaufen. Wenden Sie sich bitte an die Administration.')
...@@ -73,6 +75,12 @@ class Manager ...@@ -73,6 +75,12 @@ class Manager
$this->setAuthenticatedUser($user); $this->setAuthenticatedUser($user);
sess()->regenerateId(['auth', '_language', 'phpCAS', 'contrast']); 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)
);
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment