Hi, I’m also interested in setting a timeout or knowing how long exactly viewers of my password-protected pages have access to those pages AFTER I’ve changed the password in webflow. Thanks
I got these snippets from chatGPT. Lmk if any of them work:
Timeout user if there is no input from mouse or keyboard
<script>
// Set the timeout duration in milliseconds
const timeoutDuration = 600000; // 10 minutes
// Store the last time the user interacted with the site
let lastInteractionTime = Date.now();
// Check the interaction time periodically
setInterval(() => {
const currentTime = Date.now();
// If the timeout duration has passed, redirect to the login page and log out the user
if (currentTime - lastInteractionTime >= timeoutDuration) {
redirectToLogin();
}
}, 1000);
// Listen for user interactions and update the last interaction time
document.addEventListener('mousemove', updateInteractionTime);
document.addEventListener('mousedown', updateInteractionTime);
document.addEventListener('keypress', updateInteractionTime);
// Redirect to the login page and log out the user
function redirectToLogin() {
Webflow.Membership.logout();
window.location.href = '/log-in';
}
// Update the last interaction time
function updateInteractionTime() {
lastInteractionTime = Date.now();
}
</script>
Timeout user regardless of input from mouse or keyboard
<script>
// Set the timeout duration in milliseconds
const timeoutDuration = 600000; // 10 minutes
// Store the last time the user interacted with the site
let lastInteractionTime = Date.now();
// Check the interaction time periodically
setInterval(() => {
const currentTime = Date.now();
// If the timeout duration has passed, redirect to the login page and log out the user
if (currentTime - lastInteractionTime >= timeoutDuration) {
redirectToLogin();
}
}, 1000);
// Redirect to the login page and log out the user
function redirectToLogin() {
Webflow.Membership.logout();
window.location.href = '/log-in';
}
// Update the last interaction time
function updateInteractionTime() {
lastInteractionTime = Date.now();
}
</script>