Session timeouts and lost content changes

Hi All,
I get a bit of stick from users loosing content changes because of this. Rather than increase the session timeout I though this might be a good option. It polls farcry via ajax every 6 sec to see if you’re still logged in, if not it throws a login modal. Feel free to comment. It’s early days.

What I though would be good is if you could change the js openBootstrapModal function in farcryForm.cfm so you can override the ID name and also add style info. That way I wouldn’t need to create my own version in the webtopFooter.cfm.

https://github.com/PhillipRasmussen/farcryLoginModal

I may be reading your solution wrong, but wouldn’t the AJAX requests
automatically renew the user’s session? Doing that would effectively make
the session last forever, so users won’t ever actually log out.

Blair

Blair, where was your brain yesterday when I dreamt up this hair brained idea.
So I’m now thinking that there should be a cookie with session ‘start time’ (constantly renewed as you move through the admin). And use that instead of an ajax call. Anyone see security issues there?

Is your goal is to keep the session active as long as the user is active,
but still allow the session to expire if they forget they have the window
open? You could use a game design trick where you put in a mouse / keyboard
event on the document and set a flag every time those events trigger. In
your setTimeout, make the AJAX call when that flag is set and then reset
it. This way the session would stick around while they’re editing stuff,
and when they come back they’ll get your alert about the session having
expired.

Blair

Thanks Blair, good tips.
I’ve updated it to use ifVisible.js to check that there is activity on the page. While the script detects activity it will poll the app every 6 seconds for a minute.

I’ve added this script to both the footer of the webtop and modal. (webtopFooter and webtopFooterModal).

Strangely it thinks activity never stops on an edit page, perhaps there is some script keep the page active. But it seems to work OK.

Where this might fail (possibly, haven’t tried it) is if the user is filling out a form in the webtop, steps away, then comes back to finish it. As soon as they type they will be logged out.

How about this: Keep it the way it is now, but then when the user clicks on save or a wizard step, just pass along all of the form variables to the wizard cache. Thoughts?