erase lingering sessionStorage values when logging out

pull/1/head
ansuz 2017-02-07 10:39:42 +01:00
parent 7e7d1f7a16
commit 6f07a3b7b4
1 changed files with 15 additions and 0 deletions

View File

@ -82,6 +82,19 @@ define([
if (cb) { cb(); }
};
var eraseTempSessionValues = common.eraseTempSessionValues = function () {
// delete sessionStorage values that might have been left over
// from the main page's /user redirect
[
'login_user',
'login_pass',
'login_remember',
'register'
].forEach(function (k) {
delete sessionStorage[k];
});
};
var logout = common.logout = function (cb) {
[
userNameKey,
@ -97,6 +110,8 @@ define([
if (!localStorage[fileHashKey]) {
localStorage[fileHashKey] = common.createRandomHash();
}
eraseTempSessionValues();
if (cb) { cb(); }
};