Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Handle one time password better
Signed-off-by: Carl Schwan <[email protected]>
  • Loading branch information
CarlSchwan committed Jul 28, 2022
commit 702445ba3b454f14085710617ec09ce2134a56dc
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ public function updatePasswords(string $uid, string $password) {
$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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function testGenerateToken() {
$this->assertSame($password, $this->tokenProvider->getPassword($actual, $token));
}

public function testGenerateTokenNoPassword() {
public function testGenerateTokenNoPassword(): void {
$token = 'token';
$uid = 'user';
$user = 'User';
Expand Down Expand Up @@ -171,6 +171,10 @@ public function testUpdateToken() {
->method('updateActivity')
->with($tk, $this->time);
$tk->setLastActivity($this->time - 200);
$this->config->method('getSystemValueBool')
->willReturnMap([
['auth.storeCryptedPassword', true, true],
]);

$this->tokenProvider->updateTokenActivity($tk);

Expand Down Expand Up @@ -578,6 +582,10 @@ public function testUpdatePasswords() {
'random2',
IToken::PERMANENT_TOKEN,
IToken::REMEMBER);
$this->config->method('getSystemValueBool')
->willReturnMap([
['auth.storeCryptedPassword', true, true],
]);

$this->mapper->method('hasExpiredTokens')
->with($uid)
Expand Down