Skip to content

Commit d5ade12

Browse files
committed
Fix for E-Mail Center: MagentaCLOUD not available
(cherry picked from commit 957f90b)
1 parent eb2c553 commit d5ade12

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

lib/private/legacy/OC_User.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,15 @@
3838

3939
use OC\Authentication\Token\IProvider;
4040
use OC\User\LoginException;
41+
use OCP\Authentication\Exceptions\InvalidTokenException;
42+
use OCP\Authentication\Exceptions\WipeTokenException;
4143
use OCP\EventDispatcher\IEventDispatcher;
4244
use OCP\IGroupManager;
4345
use OCP\ISession;
4446
use OCP\IUser;
4547
use OCP\IUserManager;
4648
use OCP\Server;
49+
use OCP\Session\Exceptions\SessionNotAvailableException;
4750
use OCP\User\Events\BeforeUserLoggedInEvent;
4851
use OCP\User\Events\UserLoggedInEvent;
4952
use Psr\Log\LoggerInterface;
@@ -201,12 +204,17 @@ public static function loginWithApache(\OCP\Authentication\IApacheBackend $backe
201204

202205
if (empty($password)) {
203206
$tokenProvider = \OC::$server->get(IProvider::class);
204-
$token = $tokenProvider->getToken($userSession->getSession()->getId());
205-
$token->setScope([
206-
'password-unconfirmable' => true,
207-
'filesystem' => true,
208-
]);
209-
$tokenProvider->updateToken($token);
207+
try {
208+
$token = $tokenProvider->getToken($userSession->getSession()->getId());
209+
$token->setScope([
210+
'password-unconfirmable' => true,
211+
'filesystem' => true,
212+
]);
213+
$tokenProvider->updateToken($token);
214+
} catch (InvalidTokenException|WipeTokenException|SessionNotAvailableException) {
215+
// swallow the exceptions as we do not deal with them here
216+
// simply skip updating the token when is it missing
217+
}
210218
}
211219

212220
// setup the filesystem

0 commit comments

Comments
 (0)