diff options
author | Morris Jobke <hey@morrisjobke.de> | 2019-05-07 22:56:44 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2019-05-08 18:02:00 +0200 |
commit | f095bd1642fb9f4b08bd235ada5574b911a7662b (patch) | |
tree | b11c2c10446c5fdf83daab42f3c5551329cffdf1 | |
parent | df1f53c5c343ff6ac9c7bbe616b2c0cffe8a6380 (diff) | |
download | nextcloud-server-f095bd1642fb9f4b08bd235ada5574b911a7662b.tar.gz nextcloud-server-f095bd1642fb9f4b08bd235ada5574b911a7662b.zip |
Use non-absolute logout URL to fix wrong URL in reverse proxy scenario
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
-rw-r--r-- | lib/private/legacy/user.php | 2 | ||||
-rw-r--r-- | tests/lib/NavigationManagerTest.php | 10 |
2 files changed, 5 insertions, 7 deletions
diff --git a/lib/private/legacy/user.php b/lib/private/legacy/user.php index 3d4dc5cc982..f1c23381987 100644 --- a/lib/private/legacy/user.php +++ b/lib/private/legacy/user.php @@ -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; diff --git a/tests/lib/NavigationManagerTest.php b/tests/lib/NavigationManagerTest.php index 31efbce929c..97471fa5213 100644 --- a/tests/lib/NavigationManagerTest.php +++ b/tests/lib/NavigationManagerTest.php @@ -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); |