aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2021-07-27 14:37:15 +0200
committerGitHub <noreply@github.com>2021-07-27 14:37:15 +0200
commitd4352aaace924a0c1dfa51bb2f934ad0b5e42283 (patch)
tree8422ec218766d9dee8d165ab84927f8dcbde8213 /lib
parent7652d732cbc6b6cbb5efdc91ea25067b91e5ad16 (diff)
parent251ae10049dff5d0369fca1505b345ae60414111 (diff)
downloadnextcloud-server-d4352aaace924a0c1dfa51bb2f934ad0b5e42283.tar.gz
nextcloud-server-d4352aaace924a0c1dfa51bb2f934ad0b5e42283.zip
Merge pull request #27886 from ecsecta/keep_pw_based_authntoken_alive_on_pwlesslogin
Keep pw based auth tokens valid when pw-less login happens
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Authentication/Listeners/UserLoggedInListener.php5
-rw-r--r--lib/private/Authentication/Token/PublicKeyTokenProvider.php5
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/private/Authentication/Listeners/UserLoggedInListener.php b/lib/private/Authentication/Listeners/UserLoggedInListener.php
index e33f2bc04ca..88298889057 100644
--- a/lib/private/Authentication/Listeners/UserLoggedInListener.php
+++ b/lib/private/Authentication/Listeners/UserLoggedInListener.php
@@ -48,6 +48,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;
diff --git a/lib/private/Authentication/Token/PublicKeyTokenProvider.php b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
index ab9ff23dfd1..e8149319904 100644
--- a/lib/private/Authentication/Token/PublicKeyTokenProvider.php
+++ b/lib/private/Authentication/Token/PublicKeyTokenProvider.php
@@ -413,6 +413,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) {