From d5ade12a6081be5900c7ea6be1ed873b551ee031 Mon Sep 17 00:00:00 2001 From: "szabolcs.gyuris" Date: Fri, 11 Oct 2024 09:12:19 +0000 Subject: [PATCH] Fix for E-Mail Center: MagentaCLOUD not available (cherry picked from commit 957f90bc9484a43d503790fb621f1b855affe31f) --- lib/private/legacy/OC_User.php | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php index 8555258604d82..8a17927d1b7c6 100644 --- a/lib/private/legacy/OC_User.php +++ b/lib/private/legacy/OC_User.php @@ -38,12 +38,15 @@ use OC\Authentication\Token\IProvider; use OC\User\LoginException; +use OCP\Authentication\Exceptions\InvalidTokenException; +use OCP\Authentication\Exceptions\WipeTokenException; use OCP\EventDispatcher\IEventDispatcher; use OCP\IGroupManager; use OCP\ISession; use OCP\IUser; use OCP\IUserManager; use OCP\Server; +use OCP\Session\Exceptions\SessionNotAvailableException; use OCP\User\Events\BeforeUserLoggedInEvent; use OCP\User\Events\UserLoggedInEvent; use Psr\Log\LoggerInterface; @@ -201,12 +204,17 @@ public static function loginWithApache(\OCP\Authentication\IApacheBackend $backe if (empty($password)) { $tokenProvider = \OC::$server->get(IProvider::class); - $token = $tokenProvider->getToken($userSession->getSession()->getId()); - $token->setScope([ - 'password-unconfirmable' => true, - 'filesystem' => true, - ]); - $tokenProvider->updateToken($token); + try { + $token = $tokenProvider->getToken($userSession->getSession()->getId()); + $token->setScope([ + 'password-unconfirmable' => true, + 'filesystem' => true, + ]); + $tokenProvider->updateToken($token); + } catch (InvalidTokenException|WipeTokenException|SessionNotAvailableException) { + // swallow the exceptions as we do not deal with them here + // simply skip updating the token when is it missing + } } // setup the filesystem