WIP big commit

This commit is contained in:
ansuz
2018-07-06 11:36:48 +02:00
parent 0c3b898000
commit 57a39258c3
3 changed files with 272 additions and 39 deletions

View File

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