Browse Source

Always renew apppasswords on login

Else you can end up that you renewed your password (LDAP for example).
But they still don't work because you did not use them before you logged
in.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
pull/25460/head
Roeland Jago Douma 5 years ago
parent
commit
cd457cc68b
  1. 5
      lib/private/Authentication/Token/PublicKeyTokenProvider.php
  2. 18
      tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php

5
lib/private/Authentication/Token/PublicKeyTokenProvider.php

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

18
tests/lib/Authentication/Token/PublicKeyTokenProviderTest.php

@ -548,8 +548,7 @@ class PublicKeyTokenProviderTest extends TestCase {
IToken::PERMANENT_TOKEN,
IToken::REMEMBER);
$this->mapper->expects($this->once())
->method('hasExpiredTokens')
$this->mapper->method('hasExpiredTokens')
->with($uid)
->willReturn(true);
$this->mapper->expects($this->once())
@ -564,19 +563,4 @@ class PublicKeyTokenProviderTest extends TestCase {
$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');
}
}
Loading…
Cancel
Save