When a user logs in, and no beverage is selected within 120 seconds,
she are logged out automatically.
The main purpose for this functionality that when somebody swipes a
card in the offline mode and than goes away, because she does not see
nice graph. When the server is online again, the offline-collected
data is replayed and the user would stay logged in forever.
function login(id) {
ajax("POST", "login", id, "user");
id_user = id;
- clearTimeout(logoutTimer);
- timeToLogout = undefined;
+ countingTimeLogout(120);
}
function logout() {
function countingTimeLogout(count_time)
{
+ clearTimeout(logoutTimer);
timeToLogout = count_time;
updateUI();
if (count_time == 0) {