Add the following to header-extras.php
Code: Select all
<script type="text/javascript">
var IDLE_TIMEOUT = 30; //minutes
var _idleSecondsCounter = 0;
document.onclick = function() {
_idleSecondsCounter = 0;
};
document.onmousemove = function() {
_idleSecondsCounter = 0;
};
document.onkeypress = function() {
_idleSecondsCounter = 0;
};
window.setInterval(CheckIdleTime, 60000);
function CheckIdleTime() {
_idleSecondsCounter++;
console.log(IDLE_TIMEOUT*2);
if (_idleSecondsCounter >= IDLE_TIMEOUT*2) {
alert("Time expired!");
document.location.href = "../index.php?signOut=1";
}
}
</script>
Feel free to edit, change or suggest a better solution.
Have a nice day