From b96485b6bd30073fbce977587d7ea14c199880ed Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Tue, 5 Sep 2017 12:14:28 +0200 Subject: [PATCH] Fix login with basic auth Signed-off-by: Roeland Jago Douma --- lib/private/Authentication/TwoFactorAuth/Manager.php | 1 - 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 88ca4ba608..fd0d5914d0 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 d623edbd9d..4fa3b3d7e1 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)); } }