aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2024-10-01 15:47:11 +0200
committerGitHub <noreply@github.com>2024-10-01 15:47:11 +0200
commit7f7a3cd45ffd5ecf1606c06adb0254db7cc69a66 (patch)
treeb8d926499451f02a32175c641d7b4e6d82ea8d42 /lib
parentb30ef38be1137f5d5dcdca4115e09984be7f8b38 (diff)
parent12d39e818d25a4faa632cfd5945f7ef6ec8e8d27 (diff)
downloadnextcloud-server-7f7a3cd45ffd5ecf1606c06adb0254db7cc69a66.tar.gz
nextcloud-server-7f7a3cd45ffd5ecf1606c06adb0254db7cc69a66.zip
Merge pull request #48484 from nextcloud/fwdport/48445/master
fix(Auth): ignore missing token when trying to set password-unconfirm…
Diffstat (limited to 'lib')
-rw-r--r--lib/private/legacy/OC_User.php20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php
index 8fdba3a62b2..4cc102d6672 100644
--- a/lib/private/legacy/OC_User.php
+++ b/lib/private/legacy/OC_User.php
@@ -7,6 +7,8 @@
*/
use OC\Authentication\Token\IProvider;
use OC\User\LoginException;
+use OCP\Authentication\Exceptions\InvalidTokenException;
+use OCP\Authentication\Exceptions\WipeTokenException;
use OCP\Authentication\Token\IToken;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IGroupManager;
@@ -14,6 +16,7 @@ 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;
@@ -171,12 +174,17 @@ class OC_User {
if (empty($password)) {
$tokenProvider = \OC::$server->get(IProvider::class);
- $token = $tokenProvider->getToken($userSession->getSession()->getId());
- $token->setScope([
- IToken::SCOPE_SKIP_PASSWORD_VALIDATION => true,
- IToken::SCOPE_FILESYSTEM => true,
- ]);
- $tokenProvider->updateToken($token);
+ try {
+ $token = $tokenProvider->getToken($userSession->getSession()->getId());
+ $token->setScope([
+ IToken::SCOPE_SKIP_PASSWORD_VALIDATION => true,
+ IToken::SCOPE_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