aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-09-06 17:04:00 +0200
committerGitHub <noreply@github.com>2017-09-06 17:04:00 +0200
commit5d4540f179eb107a54f725adeebfbd5183870802 (patch)
tree3317f55c758f57d5450149fb7000d40227282f5f
parent6f7d200838082f84cd482c5f08612268c9378b9f (diff)
parentb96485b6bd30073fbce977587d7ea14c199880ed (diff)
downloadnextcloud-server-5d4540f179eb107a54f725adeebfbd5183870802.tar.gz
nextcloud-server-5d4540f179eb107a54f725adeebfbd5183870802.zip
Merge pull request #6364 from nextcloud/fix_login_loop
Fix login with basic auth
-rw-r--r--lib/private/Authentication/TwoFactorAuth/Manager.php1
-rw-r--r--tests/lib/Authentication/TwoFactorAuth/ManagerTest.php6
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));
}
}