Merge pull request #15452 from nextcloud/backport/15430/stable16
[stable16] Use non-absolute logout URL to fix wrong URL in reverse proxy scenario
This commit is contained in:
commit
6ef1b90e42
|
@ -269,7 +269,7 @@ class OC_User {
|
||||||
return $backend->getLogoutUrl();
|
return $backend->getLogoutUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
$logoutUrl = $urlGenerator->linkToRouteAbsolute('core.login.logout');
|
$logoutUrl = $urlGenerator->linkToRoute('core.login.logout');
|
||||||
$logoutUrl .= '?requesttoken=' . urlencode(\OCP\Util::callRegister());
|
$logoutUrl .= '?requesttoken=' . urlencode(\OCP\Util::callRegister());
|
||||||
|
|
||||||
return $logoutUrl;
|
return $logoutUrl;
|
||||||
|
|
|
@ -217,14 +217,12 @@ class NavigationManagerTest extends TestCase {
|
||||||
$this->urlGenerator->expects($this->any())->method('imagePath')->willReturnCallback(function ($appName, $file) {
|
$this->urlGenerator->expects($this->any())->method('imagePath')->willReturnCallback(function ($appName, $file) {
|
||||||
return "/apps/$appName/img/$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/';
|
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 = $this->createMock(IUser::class);
|
||||||
$user->expects($this->any())->method('getUID')->willReturn('user001');
|
$user->expects($this->any())->method('getUID')->willReturn('user001');
|
||||||
$this->userSession->expects($this->any())->method('getUser')->willReturn($user);
|
$this->userSession->expects($this->any())->method('getUser')->willReturn($user);
|
||||||
|
|
Loading…
Reference in New Issue