Browse Source

Clears the local storage after logout

Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
tags/v16.0.0alpha1
Michael Weimann 5 years ago
parent
commit
e083e8abc6
No account linked to committer's email address
2 changed files with 10 additions and 1 deletions
  1. 4
    1
      core/Controller/LoginController.php
  2. 6
    0
      core/js/login.js

+ 4
- 1
core/Controller/LoginController.php 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;
}

+ 6
- 0
core/js/login.js 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();
}
});

Loading…
Cancel
Save