mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 23:03:00 -04:00
Merge pull request #33225 from nextcloud/fix/handle-one-time-passwords
Handle one time password better
This commit is contained in:
commit
952acd4d27
2 changed files with 10 additions and 2 deletions
|
|
@ -401,7 +401,7 @@ class PublicKeyTokenProvider implements IProvider {
|
|||
$this->cache->clear();
|
||||
|
||||
// prevent setting an empty pw as result of pw-less-login
|
||||
if ($password === '') {
|
||||
if ($password === '' || !$this->config->getSystemValueBool('auth.storeCryptedPassword', true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ class PublicKeyTokenProviderTest extends TestCase {
|
|||
$this->assertSame($password, $this->tokenProvider->getPassword($actual, $token));
|
||||
}
|
||||
|
||||
public function testGenerateTokenNoPassword() {
|
||||
public function testGenerateTokenNoPassword(): void {
|
||||
$token = 'token';
|
||||
$uid = 'user';
|
||||
$user = 'User';
|
||||
|
|
@ -171,6 +171,10 @@ class PublicKeyTokenProviderTest extends TestCase {
|
|||
->method('updateActivity')
|
||||
->with($tk, $this->time);
|
||||
$tk->setLastActivity($this->time - 200);
|
||||
$this->config->method('getSystemValueBool')
|
||||
->willReturnMap([
|
||||
['auth.storeCryptedPassword', true, true],
|
||||
]);
|
||||
|
||||
$this->tokenProvider->updateTokenActivity($tk);
|
||||
|
||||
|
|
@ -578,6 +582,10 @@ class PublicKeyTokenProviderTest extends TestCase {
|
|||
'random2',
|
||||
IToken::PERMANENT_TOKEN,
|
||||
IToken::REMEMBER);
|
||||
$this->config->method('getSystemValueBool')
|
||||
->willReturnMap([
|
||||
['auth.storeCryptedPassword', true, true],
|
||||
]);
|
||||
|
||||
$this->mapper->method('hasExpiredTokens')
|
||||
->with($uid)
|
||||
|
|
|
|||
Loading…
Reference in a new issue