diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2016-08-30 11:10:45 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2016-08-30 11:10:45 +0200 |
commit | 0a0c7a9b927b04d441fcab8c1e5630de521743fd (patch) | |
tree | 8254c0ee882519e4eee146de94f493b65ae4a3ec | |
parent | f4dfd1f1a31eda3b89d846a619698b688571a4e2 (diff) | |
download | nextcloud-server-0a0c7a9b927b04d441fcab8c1e5630de521743fd.tar.gz nextcloud-server-0a0c7a9b927b04d441fcab8c1e5630de521743fd.zip |
redirect to default app after solving the 2FA challenge
-rw-r--r-- | core/Controller/TwoFactorChallengeController.php | 6 | ||||
-rw-r--r-- | tests/Core/Controller/TwoFactorChallengeControllerTest.php | 7 |
2 files changed, 5 insertions, 8 deletions
diff --git a/core/Controller/TwoFactorChallengeController.php b/core/Controller/TwoFactorChallengeController.php index c19cf523279..48dea062812 100644 --- a/core/Controller/TwoFactorChallengeController.php +++ b/core/Controller/TwoFactorChallengeController.php @@ -24,6 +24,8 @@ namespace OC\Core\Controller; use OC\Authentication\TwoFactorAuth\Manager; +use OC_User; +use OC_Util; use OCP\AppFramework\Controller; use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\TemplateResponse; @@ -67,7 +69,7 @@ class TwoFactorChallengeController extends Controller { * @return string */ protected function getLogoutAttribute() { - return \OC_User::getLogoutAttribute(); + return OC_User::getLogoutAttribute(); } /** @@ -143,7 +145,7 @@ class TwoFactorChallengeController extends Controller { if (!is_null($redirect_url)) { return new RedirectResponse($this->urlGenerator->getAbsoluteURL(urldecode($redirect_url))); } - return new RedirectResponse($this->urlGenerator->linkToRoute('files.view.index')); + return new RedirectResponse(OC_Util::getDefaultPageUrl()); } $this->session->set('two_factor_auth_error', true); diff --git a/tests/Core/Controller/TwoFactorChallengeControllerTest.php b/tests/Core/Controller/TwoFactorChallengeControllerTest.php index 08d8dd1452c..648d99a82fc 100644 --- a/tests/Core/Controller/TwoFactorChallengeControllerTest.php +++ b/tests/Core/Controller/TwoFactorChallengeControllerTest.php @@ -167,13 +167,8 @@ class TwoFactorChallengeControllerTest extends TestCase { ->method('verifyChallenge') ->with('myprovider', $user, 'token') ->will($this->returnValue(true)); - $this->urlGenerator->expects($this->once()) - ->method('linkToRoute') - ->with('files.view.index') - ->will($this->returnValue('files/index/url')); - $expected = new \OCP\AppFramework\Http\RedirectResponse('files/index/url'); - $this->assertEquals($expected, $this->controller->solveChallenge('myprovider', 'token')); + $this->assertInstanceOf('\OCP\AppFramework\Http\RedirectResponse', $this->controller->solveChallenge('myprovider', 'token')); } public function testSolveChallengeInvalidProvider() { |