Merge pull request #10874 from nextcloud/feature/10859/clear-localstorage-on-logout

Clears the local storage after logout
This commit is contained in:
John Molakvoæ 2019-01-29 10:39:56 +01:00 committed by GitHub
commit 34d5001e2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -130,7 +130,10 @@ class LoginController extends Controller {
}
$this->userSession->logout();
$response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('core.login.showLoginForm'));
$response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute(
'core.login.showLoginForm',
['clear' => true] // this param the the code in login.js may be removed when the "Clear-Site-Data" is working in the browsers
));
$response->addHeader('Clear-Site-Data', '"cache", "storage", "executionContexts"');
return $response;
}

View file

@ -41,4 +41,10 @@ $(document).ready(function() {
$('form[name=login]').submit(OC.Login.onLogin);
$('#remember_login').click(OC.Login.rememberLogin);
var clearParamRegex = new RegExp('clear=1');
if (clearParamRegex.test(window.location.href)) {
window.localStorage.clear();
window.sessionStorage.clear();
}
});