Auto Save before Security Logout

I have a Security Logout that runs when the page has been inactive for 10 minutes. This works great except if the user has left a form without saving then all their changes are lost. I have one form, in particular, for blog posts which is super easy to get distracted by something else half way through writing and then come back and it’s all gone.

Is there any way to save a forms data before the Security redirect? Bonus points for having that same form open up again in the same place after logging back in!

Thanks,
Heather

Could store it all to local storage (Data Store) including the form location. Then check to see if a location is set for the form and browser redirect if contains and standard redirect if nothing… Might take a bit of playing around with but should be quite straight forward. Obviously this would be lost if the user clears their browser cache. Could also clear the Data Store on form submit so there is no residual data playing any part in your redirects. Should be able to do this with a simple Flow? Just a quick idea…

1 Like

And auto-save option would be better than relying on client side storage.
Setup a timer which keeps auto-saving the form in the DB every few seconds or when a value changes in any of the fields.
Not sure what would work better on your app based on its implementation.

To auto-redirect to last form, after login, just check in the DB to identify an auto-saved form and do a browser.goto based on that response on success of the login SA.

Hi @Heather_Mann,
Could you please explain how you managed to get Security Logout to auto run after 10 min of user inactivity?

Much appreciated. I need to do this for one of our pages.

Thank you.

  • Add a logout action to your page (Be sure it has autorun turned off)
  • Add an action Scheduler to the page set to ten minutes and run the logout.

One caveat is that if the user refreshes the page or moves to another page and back the scheduler will reset.

1 Like

Would there be a condition to run the logout. As in don’t we have to say if no user activity, like mouse move, or click etc?

If there is no activity the scheduler will keep running. No need to set anything.

Great. I will try that. Thanks very much @brad.

1 Like

If you want to restart the scheduler on activity such as mouse click you need to add it to the body tag such as this:

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

so it is necessary to add that condition then? I thought the scheduler will keep going and run logout after 10 min regardless?

Without that on click event it will logout regardless as soon as the scheduler times out. You only need that code if you want to reset the timer on activity. If you just want it to time out after 10 minutes regardless of activity then just use the scheduler as is.

will need the on click event, pointless logging out a user that is active on a page, reading and typing etc.

1 Like