Merge pull request #25460 from nextcloud/fix/apppassword/always_renew

Always renew apppasswords on login
This commit is contained in:
Roeland Jago Douma 2021-02-10 21:09:20 +01:00 committed by GitHub
commit 7bacd710a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 22 deletions

View File

@ -414,11 +414,6 @@ class PublicKeyTokenProvider implements IProvider {
public function updatePasswords(string $uid, string $password) { public function updatePasswords(string $uid, string $password) {
$this->cache->clear(); $this->cache->clear();
if (!$this->mapper->hasExpiredTokens($uid)) {
// Nothing to do here
return;
}
// Update the password for all tokens // Update the password for all tokens
$tokens = $this->mapper->getTokenByUser($uid); $tokens = $this->mapper->getTokenByUser($uid);
foreach ($tokens as $t) { foreach ($tokens as $t) {

View File

@ -548,8 +548,7 @@ class PublicKeyTokenProviderTest extends TestCase {
IToken::PERMANENT_TOKEN, IToken::PERMANENT_TOKEN,
IToken::REMEMBER); IToken::REMEMBER);
$this->mapper->expects($this->once()) $this->mapper->method('hasExpiredTokens')
->method('hasExpiredTokens')
->with($uid) ->with($uid)
->willReturn(true); ->willReturn(true);
$this->mapper->expects($this->once()) $this->mapper->expects($this->once())
@ -564,19 +563,4 @@ class PublicKeyTokenProviderTest extends TestCase {
$this->tokenProvider->updatePasswords($uid, 'bar2'); $this->tokenProvider->updatePasswords($uid, 'bar2');
} }
public function testUpdatePasswordsNotRequired() {
$uid = 'myUID';
$this->mapper->expects($this->once())
->method('hasExpiredTokens')
->with($uid)
->willReturn(false);
$this->mapper->expects($this->never())
->method('getTokenByUser');
$this->mapper->expects($this->never())
->method('update');
$this->tokenProvider->updatePasswords($uid, 'bar2');
}
} }