]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use non-absolute logout URL to fix wrong URL in reverse proxy scenario 15430/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 16:02:00 +0000 (18:02 +0200)
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
lib/private/legacy/user.php
tests/lib/NavigationManagerTest.php

index 3d4dc5cc9828be756e0c7b5fe86db6a1da03d708..f1c233819875d16fa0d77dd615765e14cb91c0e9 100644 (file)
@@ -269,7 +269,7 @@ class OC_User {
                        return $backend->getLogoutUrl();
                }
 
-               $logoutUrl = $urlGenerator->linkToRouteAbsolute('core.login.logout');
+               $logoutUrl = $urlGenerator->linkToRoute('core.login.logout');
                $logoutUrl .= '?requesttoken=' . urlencode(\OCP\Util::callRegister());
 
                return $logoutUrl;
index 31efbce929c5286d9c8061c4ca92ed958f0e342b..97471fa52132e25a69c57075d482780381cfe0c1 100644 (file)
@@ -217,14 +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')
-                       ->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);