diff options
-rw-r--r-- | lib/private/Authentication/TwoFactorAuth/Manager.php | 1 | ||||
-rw-r--r-- | tests/lib/Authentication/TwoFactorAuth/ManagerTest.php | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index 88ca4ba6084..fd0d5914d02 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -293,7 +293,6 @@ class Manager { return false; } } catch (InvalidTokenException $e) { - return true; } } diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php index d623edbd9d9..4fa3b3d7e14 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php @@ -566,6 +566,8 @@ class ManagerTest extends TestCase { } public function testNeedsSecondFactorInvalidToken() { + $this->prepareNoProviders(); + $user = $this->createMock(IUser::class); $user->method('getUID') ->willReturn('user'); @@ -579,6 +581,8 @@ class ManagerTest extends TestCase { ->with('mysessionid') ->willThrowException(new OC\Authentication\Exceptions\InvalidTokenException()); - $this->assertTrue($this->manager->needsSecondFactor($user)); + $this->config->method('getUserKeys')->willReturn([]); + + $this->assertFalse($this->manager->needsSecondFactor($user)); } } |