diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2024-09-30 10:06:58 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2024-09-30 10:06:58 +0200 |
commit | 4dd1f380afe10692b07565b9c27ef252191d36d8 (patch) | |
tree | 84149ccfd71573625f711e36f03d12b2a2ba0ecc | |
parent | 07f914e7dfa8c440b712680435a5acdce1df19da (diff) | |
download | nextcloud-server-fix/noid/ignore-unavailable-token.tar.gz nextcloud-server-fix/noid/ignore-unavailable-token.zip |
fix(Auth): ignore missing token when trying to set password-unconfirmablefix/noid/ignore-unavailable-token
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
-rw-r--r-- | lib/private/legacy/OC_User.php | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php index 1174c492fef..9fd4e502fb4 100644 --- a/lib/private/legacy/OC_User.php +++ b/lib/private/legacy/OC_User.php @@ -37,12 +37,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; @@ -200,12 +203,17 @@ class OC_User { 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 |