Mercurial > hg > rlgwebd
diff rlgterm.js @ 47:27b7f0c8b9f0
RLG-Web: make login sessions time out.
After enough inactivity, log the user out automatically.
author | John "Elwin" Edwards <elwin@sdf.org> |
---|---|
date | Sat, 09 Jun 2012 21:20:14 -0700 |
parents | 59ecd99845eb |
children | 2eda3909f6a3 |
line wrap: on
line diff
--- a/rlgterm.js Sat Jun 09 17:00:25 2012 -0700 +++ b/rlgterm.js Sat Jun 09 21:20:14 2012 -0700 @@ -164,6 +164,9 @@ else if (msgDict.t == "E") { if (msgDict.c == 1 || msgDict.c == 6 || msgDict.c == 7) { gameover(); + if (msgDict.c == 1) { + logout(); + } } debug(1, "Server error: " + msgDict.s); } @@ -496,6 +499,9 @@ } else if (reply.t == 'E') { debug(1, "Could not start game: " + reply.s); + if (reply.c == 1) { + logout(); + } } }; req.open('POST', '/play', true); @@ -551,6 +557,12 @@ return; } +function logout() { + lcred = null; + lname = null; + setmode("login"); +} + function stop() { if (!termemu.sessid) return;