Session duration and auto log out

hi there,

I had a user who left his session open from Saturday to Monday. when he came back on Monday, he could no longer access his data but he was not logged out either. At least that is my interpretation of what happened. So it looked as he had not created some things that he did create. Then he logged out and logged in again and the things were there.

Questions:

  1. how do we control session duration?
  2. how do we log out users automatically if session expires?

Thanks.

Happy to outline a potential solution below:

  1. Create a data field under your user data type called ‘log-in-time’. Set this field type to be a date.

  2. Create a workflow that runs every time the page is loaded. Within this workflow, you can update the ‘log-in-time’ field to be the current date time.

  3. This log-in time will update each time a page will load, therefore, resetting the user’s session. If you’d like to avoid this, you could create a condition on the workflow trigger that only allows it to run when the 'log-in time’s date is the current date time +X hrs/mins.

This means that in an average user session, this time should only update once. Of course, if the user leaves the session open and doesn’t refresh the page, this data field wouldn’t update.

  1. Create another workflow that’s triggered from the ‘do when condition is true’ action. The condition could recognise when the current date/time is X minutes (however long you’d like a session to be) greater than the ‘log-in-time’ field on a users profile.

If this condition is true, you could run add an action to then log the user out and send them through to the login page.

Hope this helps point you in the right direction!

2 Likes

hi @lachlankirkwood1 - thanks a lot for the input.

I ended up googling and implementing something before I had a chance to read your post.

These are the building blocks of the solution:

  1. i installed a free plug in to detect inactivity (detect inactivity, free plugin)

  2. I installed the plugin “countdown” (also a free plugin)

  3. set up the inactivity plugin to activate after x minutes

  4. at that point in time, a pop up appears and i start a countdown

  5. if the user does not react during the countdown, they are logged out

I also allowed for changing the inactivity time in the user settings, with a minimum of X.

Worked pretty well, the UX also looks nice. Again, thanks for the tip and apologies that I did not see it in time. Posting the solution here in the event anyone is interested.

4 Likes

This topic was automatically closed after 70 days. New replies are no longer allowed.