From f0d9821a72b0384b3e71b3da9aa2f87d42c5dcf6 Mon Sep 17 00:00:00 2001 From: mjansen Date: Thu, 7 May 2026 09:29:00 +0200 Subject: [PATCH] [IMPROVEMENT] Auth: Batch `ilObjUser::update(...)` calls into one See: https://mantis.ilias.de/view.php?id=47742 --- .../classes/Frontend/class.ilAuthFrontend.php | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/components/ILIAS/Authentication/classes/Frontend/class.ilAuthFrontend.php b/components/ILIAS/Authentication/classes/Frontend/class.ilAuthFrontend.php index f9b656e3d486..096ab5b14666 100755 --- a/components/ILIAS/Authentication/classes/Frontend/class.ilAuthFrontend.php +++ b/components/ILIAS/Authentication/classes/Frontend/class.ilAuthFrontend.php @@ -43,8 +43,6 @@ class ilAuthFrontend private ilUserProfile $user_profile; - private bool $authenticated = false; - /** * @param ilAuthSession $session * @param ilAuthStatus $status @@ -292,13 +290,20 @@ protected function handleAuthenticationSuccess(ilAuthProviderInterface $provider } // check if profile is complete - if ( - $this->user_profile->isProfileIncomplete($user) && - ilAuthFactory::getContext() !== ilAuthFactory::CONTEXT_ECS && - ilContext::getType() !== ilContext::CONTEXT_LTI_PROVIDER - ) { + $profile_incomplete = ilAuthFactory::getContext() !== ilAuthFactory::CONTEXT_ECS + && ilContext::getType() !== ilContext::CONTEXT_LTI_PROVIDER + && $this->user_profile->isProfileIncomplete($user); + if ($profile_incomplete) { ilLoggerFactory::getLogger('auth')->info('User profile is incomplete.'); $user->setProfileIncomplete(true); + } + + $has_login_attempts = $user->getLoginAttempts() > 0; + if ($has_login_attempts) { + $user->setLoginAttempts(0); + } + + if ($profile_incomplete || $has_login_attempts) { $user->update(); } @@ -322,12 +327,6 @@ protected function handleAuthenticationSuccess(ilAuthProviderInterface $provider } $user->refreshLogin(); - if ($user->getLoginAttempts() > 0) { - $user->setLoginAttempts(0); - $user->update(); - } - - $this->logger->info('Successfully authenticated: ' . ilObjUser::_lookupLogin($this->getStatus()->getAuthenticatedUserId())); $this->getAuthSession()->setAuthenticated(true, $this->getStatus()->getAuthenticatedUserId());