Merge pull request #29131 from nextcloud/backport/27886/stable20

[stable20] Keep pw based auth tokens valid when pw-less login happens
This commit is contained in:
Joas Schilling 2021-10-11 15:33:43 +02:00 committed by GitHub
commit a6069d75c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -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;

View file

@ -419,6 +419,11 @@ class PublicKeyTokenProvider implements IProvider {
return;
}
// 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) {