Home / Auto-logout inactive users
Duplicate Snippet

Embed Snippet on Your Site

Auto-logout inactive users

Automatically logout users after 10 minutes.

<10
Code Preview
universal
<script type="text/javascript">
	var logoutUrl = '<?php echo htmlspecialchars_decode( wp_logout_url() ); ?>';
	var timeout;
	document.onload = resetTimeout;
	document.onmousemove = resetTimeout;
	document.onkeypress = resetTimeout;
	function resetTimeout() {
		clearTimeout( timeout );
		timeout = setTimeout( function () {
			window.location.href = logoutUrl;
		}, 600000 ); // 10 minutes
	}
</script>

Comments

Add a Comment