Merge pull request #27886 from ecsecta/keep_pw_based_authntoken_alive_on_pwlesslogin

Keep pw based auth tokens valid when pw-less login happens
pull/28210/head
Lukas Reschke 2021-07-27 14:37:15 +07:00 committed by GitHub
commit d4352aaace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

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

@ -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) {