diff options
| author | Jules Laplace <jules@okfoc.us> | 2013-02-23 19:55:33 -0800 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2013-02-23 19:55:33 -0800 |
| commit | bf32beb46a38615fa16fc96f2c0225d04cc90434 (patch) | |
| tree | 5dc3bdc22c0c72112091128b356447848c8d2f5c | |
| parent | b972385a838e0f54755d8e9a59bcf6ca5aeee463 (diff) | |
hide login box if nick in localstorage
| -rw-r--r-- | public/js/auth.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/public/js/auth.js b/public/js/auth.js index 6cdc4c0..4e301e8 100644 --- a/public/js/auth.js +++ b/public/js/auth.js @@ -2,6 +2,7 @@ var Auth = { init: function(){ Auth.bind(); if (Auth.loggedIn()) { + $("#login").hide(); } else { $("#login").show(); @@ -18,8 +19,8 @@ var Auth = { }); }, loggedIn: function(){ - if (localStorage && localStorage.nick) { - Game.nick = strip(localStorage.nick); + if (localStorage && localStorage['nick']) { + Game.nick = strip(localStorage['nick']); if (Game.nick.length == 0) return false; return true; } @@ -28,7 +29,7 @@ var Auth = { login: function(){ Game.nick = strip( $("#username").val() ); if (Game.nick.length == 0) return; - localStorage.nick = Game.nick; + localStorage['nick'] = Game.nick; $("#username").val(""); $("#login").hide(); }, |
