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.
- how do we control session duration?
- how do we log out users automatically if session expires?
Happy to outline a potential solution below:
Create a data field under your user data type called ‘log-in-time’. Set this field type to be a date.
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.
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.
- 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!
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:
i installed a free plug in to detect inactivity (detect inactivity, free plugin)
I installed the plugin “countdown” (also a free plugin)
set up the inactivity plugin to activate after x minutes
at that point in time, a pop up appears and i start a countdown
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.
This topic was automatically closed after 70 days. New replies are no longer allowed.