Implement session expiration enforcement: clear remember cookies and redirect to login on session expiry; update header script for daily re-login requirement.
This commit is contained in:
+20
-1
@@ -57,10 +57,20 @@ $currentUserTheme = !empty($currentUser['id']) ? get_user_theme((int)$currentUse
|
||||
</script>
|
||||
<!-- Lucide Icons -->
|
||||
<script src="https://unpkg.com/lucide@latest"></script>
|
||||
<!-- Dagsessie Expiratie Watchdog: reset iedere nacht om 23:59:59 -->
|
||||
<!-- Dagsessie Expiratie Watchdog: reset iedere nacht om 23:59:59 en dwingt dagelijks opnieuw inloggen af -->
|
||||
<script>
|
||||
(function() {
|
||||
try {
|
||||
const sessionDate = "<?= date('Y-m-d') ?>";
|
||||
const checkMidnight = function() {
|
||||
const now = new Date();
|
||||
const midnight = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
|
||||
const todayStr = now.getFullYear() + '-' + String(now.getMonth() + 1).padStart(2, '0') + '-' + String(now.getDate()).padStart(2, '0');
|
||||
if (todayStr !== sessionDate || now.getTime() > midnight.getTime()) {
|
||||
window.location.href = '/auth/login.php?expired=1';
|
||||
}
|
||||
};
|
||||
|
||||
const now = new Date();
|
||||
const midnight = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 23, 59, 59, 999);
|
||||
const msUntilMidnight = midnight.getTime() - now.getTime();
|
||||
@@ -69,6 +79,15 @@ $currentUserTheme = !empty($currentUser['id']) ? get_user_theme((int)$currentUse
|
||||
window.location.href = '/auth/login.php?expired=1';
|
||||
}, msUntilMidnight);
|
||||
}
|
||||
|
||||
// Controleer direct zodra de gebruiker de browser weer activeert (bij bijv. standby / slaapstand overnacht)
|
||||
document.addEventListener('visibilitychange', function() {
|
||||
if (document.visibilityState === 'visible') {
|
||||
checkMidnight();
|
||||
}
|
||||
});
|
||||
window.addEventListener('focus', checkMidnight);
|
||||
setInterval(checkMidnight, 30000);
|
||||
} catch(e) {}
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user