]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use non-absolute logout URL to fix wrong URL in reverse proxy scenario 15456/head
authorMorris Jobke <hey@morrisjobke.de>
Tue, 7 May 2019 20:56:44 +0000 (22:56 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Wed, 8 May 2019 21:38:42 +0000 (23:38 +0200)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
lib/private/legacy/user.php
tests/lib/NavigationManagerTest.php

index e006a59771a7b1c2d934dbd0dbba2db69b0f0127..f883c3a82d0a8f8257fb626d819f28c242d72c03 100644 (file)
@@ -269,7 +269,7 @@ class OC_User {
                        return $backend->getLogoutUrl();
                }
 
-               $logoutUrl = $urlGenerator->linkToRouteAbsolute(
+               $logoutUrl = $urlGenerator->linkToRoute(
                        'core.login.logout',
                        [
                                'requesttoken' => \OCP\Util::callRegister(),
index 8c451109ef95d2430049cfc3253cae93a13615b4..c11d9f0e4defc5cfd99e508a0add128b7d413f06 100644 (file)
@@ -217,19 +217,12 @@ class NavigationManagerTest extends TestCase {
                $this->urlGenerator->expects($this->any())->method('imagePath')->willReturnCallback(function ($appName, $file) {
                        return "/apps/$appName/img/$file";
                });
-               $this->urlGenerator->expects($this->any())->method('linkToRoute')->willReturnCallback(function () {
+               $this->urlGenerator->expects($this->any())->method('linkToRoute')->willReturnCallback(function ($route) {
+                       if ($route === 'core.login.logout') {
+                               return 'https://example.com/logout';
+                       }
                        return '/apps/test/';
                });
-               $this->urlGenerator
-                    ->expects($this->once())
-                    ->method('linkToRouteAbsolute')
-                    ->with(
-                            'core.login.logout',
-                            [
-                                    'requesttoken' => \OCP\Util::callRegister()
-                            ]
-                    )
-                    ->willReturn('https://example.com/logout');
                $user = $this->createMock(IUser::class);
                $user->expects($this->any())->method('getUID')->willReturn('user001');
                $this->userSession->expects($this->any())->method('getUser')->willReturn($user);