diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index 5d5ae666ca132..876a1267e9028 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -128,7 +128,11 @@ public function logout() { $this->session->set('clearingExecutionContexts', '1'); $this->session->close(); - $response->addHeader('Clear-Site-Data', '"cache", "storage"'); + + if (!$this->request->isUserAgent(['#Chrome/#'])) { + $response->addHeader('Clear-Site-Data', '"cache", "storage"'); + } + return $response; } diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php index df1b12b970954..cd82c1487586c 100644 --- a/tests/Core/Controller/LoginControllerTest.php +++ b/tests/Core/Controller/LoginControllerTest.php @@ -142,6 +142,26 @@ public function testLogoutWithoutToken() { $this->assertEquals($expected, $this->loginController->logout()); } + public function testLogoutNoClearSiteData() { + $this->request + ->expects($this->once()) + ->method('getCookie') + ->with('nc_token') + ->willReturn(null); + $this->request + ->expects($this->once()) + ->method('isUserAgent') + ->willReturn(true); + $this->urlGenerator + ->expects($this->once()) + ->method('linkToRouteAbsolute') + ->with('core.login.showLoginForm') + ->willReturn('/login'); + + $expected = new RedirectResponse('/login'); + $this->assertEquals($expected, $this->loginController->logout()); + } + public function testLogoutWithToken() { $this->request ->expects($this->once())