From 2e03485db4f29e7a30b7bd94e916f0e400f72bf9 Mon Sep 17 00:00:00 2001 From: ansuz Date: Wed, 31 May 2017 18:12:58 +0200 Subject: [PATCH] remove known bad entries from localStorage.userHash... --- www/common/cryptpad-common.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 93dc1a4fc..ee9daeb49 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -246,10 +246,15 @@ define([ var getUserHash = common.getUserHash = function () { var hash = localStorage[userHashKey]; - if (hash && ['undefined', 'undefined/'].indexOf(hash) === -1) { + if (['undefined', 'undefined/'].indexOf(hash) === -1) { + localStorage.removeItem(userHashKey); + return; + } + + if (hash) { var sHash = common.serializeHash(hash); if (sHash !== hash) { localStorage[userHashKey] = sHash; } - } else { return; } + } return hash; };