always set userHash in localStorage even with modern users

This commit is contained in:
ansuz
2018-07-10 13:11:22 +02:00
parent ce7ebf0326
commit 0a9ea95796
3 changed files with 28 additions and 19 deletions

View File

@@ -75,18 +75,11 @@ define([
typeof getUserHash() === "string";
};
// XXX update this to take into account blockHash values
LocalStore.login = function (hash, name, cb) {
if (hash !== false && !hash) { throw new Error('expected a user hash'); }
if (!hash) { throw new Error('expected a user hash'); }
if (!name) { throw new Error('expected a user name'); }
if (hash) {
hash = Hash.serializeHash(hash);
localStorage.setItem(Constants.userHashKey, hash);
}
hash = Hash.serializeHash(hash);
localStorage.setItem(Constants.userHashKey, hash);
localStorage.setItem(Constants.userNameKey, name);
if (cb) { cb(); }
};