]> source.dussan.org Git - nextcloud-server.git/commitdiff
redirect to default app after solving the 2FA challenge
authorChristoph Wurst <christoph@winzerhof-wurst.at>
Tue, 30 Aug 2016 09:10:45 +0000 (11:10 +0200)
committerJulius Haertl <jus@bitgrid.net>
Wed, 21 Sep 2016 10:57:37 +0000 (12:57 +0200)
core/Controller/TwoFactorChallengeController.php
tests/Core/Controller/TwoFactorChallengeControllerTest.php

index b9e10b147ce6aab8147acc7a0a159637d79c482f..7d72a7a2cf4562e0c92ec6a85bc58e16aec92bad 100644 (file)
@@ -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);
index 08d8dd1452ca3d4735e0654d30790db787dd10da..648d99a82fcd3dce6c6243b01a8bade89b86d35e 100644 (file)
@@ -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() {