if (currentTime - lastTime > idleTimeoutMs) {
//logout
sh.reset();
- sh.sessionClosed();
+ sh.sessionClosed("Session timed out after " + timeout + " seconds.");
document.body.onmousemove = undefined;
document.body.onkeydown = undefined;
} else {
sh.keysPressed(token + "\n");
sh.vt100('(sent authentication token)\n');
token = null;
- updateIdleTimer();
- document.body.onmousemove = updateIdleTimer;
- document.body.onkeydown = updateIdleTimer;
- setTimeout(checkIdleTimer, 1000);
+ if (timeout > 0) {
+ updateIdleTimer();
+ document.body.onmousemove = updateIdleTimer;
+ document.body.onkeydown = updateIdleTimer;
+ setTimeout(checkIdleTimer, 1000);
+ }
} else {
setTimeout(trySendToken, 200);
}
};
extend(ShellInABox, VT100);
-ShellInABox.prototype.sessionClosed = function() {
+ShellInABox.prototype.sessionClosed = function(msg) {
try {
this.connected = false;
if (this.session) {
if (this.cursorX > 0) {
this.vt100('\r\n');
}
- this.vt100('Session closed.');
+ this.vt100(msg || 'Session closed.');
this.currentRequest.abort();
}
// Revealing the "reconnect" button is commented out until we hook