]> source.dussan.org Git - nextcloud-server.git/commitdiff
draft to prevent the invalidation of pw based authn tokens on a pw less login
authorTobias Assmann <tobias.assmann@ecsec.de>
Fri, 9 Jul 2021 07:35:12 +0000 (09:35 +0200)
committerJulius Härtl <jus@bitgrid.net>
Fri, 8 Oct 2021 06:08:28 +0000 (08:08 +0200)
Signed-off-by: Tobias Assmann <tobias.assmann@ecsec.de>
lib/private/Authentication/Listeners/UserLoggedInListener.php
lib/private/Authentication/Token/PublicKeyTokenProvider.php

index 711a759fad40b35fa11123b7bf32d9dbd43fa944..d0ad8e2e838f718ba65dd3d6787b467ecb924d74 100644 (file)
@@ -49,6 +49,11 @@ class UserLoggedInListener implements IEventListener {
                        return;
                }
 
+               // prevent setting an empty pw as result of pw-less-login
+               if ($event->getPassword()==='') {
+                       return;
+               }
+
                // If this is already a token login there is nothing to do
                if ($event->isTokenLogin()) {
                        return;
index a293d2a8404243e18700f5d361b8723b54995e89..222e5cba099e48acddbd5f01adf50fcca185ce2e 100644 (file)
@@ -414,6 +414,11 @@ class PublicKeyTokenProvider implements IProvider {
        public function updatePasswords(string $uid, string $password) {
                $this->cache->clear();
 
+               // prevent setting an empty pw as result of pw-less-login
+               if ($password==='') {
+                       return;
+               }
+
                // Update the password for all tokens
                $tokens = $this->mapper->getTokenByUser($uid);
                foreach ($tokens as $t) {