Add ability to force player logout via ping response
(session timeout/kicked user)
This commit is contained in:
parent
93113b8501
commit
8d00ca9b69
@ -196,9 +196,18 @@ var updatePosition = function (position) {
|
|||||||
}
|
}
|
||||||
mapPos(latitude, longitude);
|
mapPos(latitude, longitude);
|
||||||
};
|
};
|
||||||
|
|
||||||
function pingServer() {
|
function pingServer() {
|
||||||
if (lockGot && gpsaccuracy < requiredaccuracy) {
|
if (lockGot && gpsaccuracy < requiredaccuracy) {
|
||||||
$.get(mkApiUrl('ping') + "?user=" + username + "&lat=" + latitude + "&long=" + longitude);
|
$.getJSON(mkApiUrl('ping') + "?user=" + username + "&lat=" + latitude + "&long=" + longitude, function (data) {
|
||||||
|
if (data.status == "ERROR") {
|
||||||
|
navigator.notification.alert("Your account status has changed, and you have been logged out. Reason: " + data.message, "Account Status Changed", "OK");
|
||||||
|
localStorage.setItem("no_autologin", true);
|
||||||
|
username = null;
|
||||||
|
password = null;
|
||||||
|
openscreen('login');
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
passset = true;
|
passset = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userset && passset) {
|
if (userset && passset && localStorage.getItem("no_autologin") !== true) {
|
||||||
// Try to login with stored credentials
|
// Try to login with stored credentials
|
||||||
$.post("https://sso.netsyms.com/api/simpleauth.php",
|
$.post("https://sso.netsyms.com/api/simpleauth.php",
|
||||||
{user: localStorage.getItem("username"), pass: localStorage.getItem("password")},
|
{user: localStorage.getItem("username"), pass: localStorage.getItem("password")},
|
||||||
@ -125,6 +125,8 @@
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
$('#loading').css('display', 'none');
|
$('#loading').css('display', 'none');
|
||||||
|
// Remove autologin block
|
||||||
|
localStorage.setItem("no_autologin", false);
|
||||||
updateStatusBarColor();
|
updateStatusBarColor();
|
||||||
}
|
}
|
||||||
navigator.splashscreen.hide();
|
navigator.splashscreen.hide();
|
||||||
|
Reference in New Issue
Block a user