mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 20:55:28 +00:00
Move login form to a new page
Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
This commit is contained in:
@@ -256,36 +256,41 @@ $("#pihole-disable-custom").on("click", function (e) {
|
||||
});
|
||||
|
||||
// Session timer
|
||||
var sessionTimerCounter = document.getElementById("sessiontimercounter");
|
||||
var sessionvalidity = parseInt(sessionTimerCounter.textContent, 10);
|
||||
var start = new Date();
|
||||
|
||||
function updateSessionTimer() {
|
||||
start = new Date();
|
||||
start.setSeconds(start.getSeconds() + sessionvalidity);
|
||||
}
|
||||
|
||||
if (sessionvalidity > 0) {
|
||||
// setSeconds will correctly handle wrap-around cases
|
||||
updateSessionTimer();
|
||||
var sessionTimerCounter, sessionvalidity, start;
|
||||
|
||||
setInterval(function () {
|
||||
var current = new Date();
|
||||
var totalseconds = (start - current) / 1000;
|
||||
var minutes = Math.floor(totalseconds / 60);
|
||||
if (minutes < 10) {
|
||||
minutes = "0" + minutes;
|
||||
}
|
||||
var sessiontimer = document.getElementById("sessiontimer");
|
||||
if (sessiontimer) {
|
||||
sessionTimerCounter = document.getElementById("sessiontimercounter");
|
||||
sessionvalidity = parseInt(sessionTimerCounter.textContent, 10);
|
||||
start = new Date();
|
||||
|
||||
var seconds = Math.floor(totalseconds % 60);
|
||||
if (seconds < 10) {
|
||||
seconds = "0" + seconds;
|
||||
}
|
||||
if (sessionvalidity > 0) {
|
||||
// setSeconds will correctly handle wrap-around cases
|
||||
updateSessionTimer();
|
||||
|
||||
sessionTimerCounter.textContent = totalseconds > 0 ? minutes + ":" + seconds : "-- : --";
|
||||
}, 1000);
|
||||
} else {
|
||||
document.getElementById("sessiontimer").style.display = "none";
|
||||
setInterval(function () {
|
||||
var current = new Date();
|
||||
var totalseconds = (start - current) / 1000;
|
||||
var minutes = Math.floor(totalseconds / 60);
|
||||
if (minutes < 10) {
|
||||
minutes = "0" + minutes;
|
||||
}
|
||||
|
||||
var seconds = Math.floor(totalseconds % 60);
|
||||
if (seconds < 10) {
|
||||
seconds = "0" + seconds;
|
||||
}
|
||||
|
||||
sessionTimerCounter.textContent = totalseconds > 0 ? minutes + ":" + seconds : "-- : --";
|
||||
}, 1000);
|
||||
} else {
|
||||
sessiontimer.style.display = "none";
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Ctrl + Enter button on Login page
|
||||
|
||||
Reference in New Issue
Block a user