RLG-Web: make login sessions time out.
After enough inactivity, log the user out automatically.
This commit is contained in:
parent
aba0a4b7da
commit
20d72fc066
2 changed files with 55 additions and 4 deletions
12
rlgterm.js
12
rlgterm.js
|
|
@ -164,6 +164,9 @@ function processMsg(msg) {
|
|||
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 @@ function startgame(game) {
|
|||
}
|
||||
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 @@ function gameover() {
|
|||
return;
|
||||
}
|
||||
|
||||
function logout() {
|
||||
lcred = null;
|
||||
lname = null;
|
||||
setmode("login");
|
||||
}
|
||||
|
||||
function stop() {
|
||||
if (!termemu.sessid)
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue