aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2024-09-30 10:06:58 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2024-10-01 17:34:00 +0200
commit966bb302d339df0dbd8222c55c0c22aff287055e (patch)
treeeb72f68095bf4f98a6ed7502b1dee7a530735bda
parent0109d2f3b32a84ec08ddaf377a0ad89ae3863648 (diff)
downloadnextcloud-server-backport/48445/stable27.tar.gz
nextcloud-server-backport/48445/stable27.zip
fix(Auth): ignore missing token when trying to set password-unconfirmablebackport/48445/stable27
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
-rw-r--r--lib/private/legacy/OC_User.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/private/legacy/OC_User.php b/lib/private/legacy/OC_User.php
index 768237f96c9..8eaf584c72d 100644
--- a/lib/private/legacy/OC_User.php
+++ b/lib/private/legacy/OC_User.php
@@ -35,6 +35,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
+
+use OC\Authentication\Exceptions\InvalidTokenException;
+use OC\Authentication\Exceptions\WipeTokenException;
use OC\Authentication\Token\IProvider;
use OC\User\LoginException;
use OCP\EventDispatcher\IEventDispatcher;
@@ -42,6 +45,7 @@ use OCP\ILogger;
use OCP\ISession;
use OCP\IUserManager;
use OCP\Server;
+use OCP\Session\Exceptions\SessionNotAvailableException;
use OCP\User\Events\BeforeUserLoggedInEvent;
use OCP\User\Events\UserLoggedInEvent;
@@ -198,12 +202,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