- } else if (timeLeft < 1) {
- timeLeft = 'Expired';
- console.log('Session valid < 1');
- document.getElementById("time").style.background = "red";
+ } else if (timeLeft == 1) {
+ if (timeLeft < last || last == -1) {
+ last = timeLeft;
+ timeLeft = '< ' + timeLeft + ' min';
+ console.log('Session soon to expire');
+ document.getElementById("time").style.background = "red";
+ document.getElementById("timer").innerHTML = timeLeft;
+ }