Auto Logout User on Session Expiry

The event should run as soon as the tab/page is focused again.

What I have done is hooked up my logout action to a scheduler for better control over the length. So if the scheduler hits while the page is not focused it will just wait and as soon as page is focused it should run the logout script.

Again, it’s been a couple years since I needed to do this so I’d have to go back and check my code exactly.

Here is my scheduler set up. After four hours it will trigger the logout action.

To reset the time if a staff member is actually on that page I have set an onClick event to the body tag that restarts the scheduler. So any time the user interacts with the page the scheduler restarts.

<body is="dmx-app" dmx-on:click="schedulerLogOut.start()">
3 Likes