Timeoutable and what counts as "user activity"?

101 views
Skip to first unread message

Kenton Newby

unread,
Dec 4, 2014, 9:42:58 PM12/4/14
to plataforma...@googlegroups.com
I'm working on an app that uses devise and allows the User to view a series of videos.

The requirements are for the session timeout to be set to, say 45 minutes.

If the User is watching a video that's, say, an hour long, and is just watching it, not interacting with the browser in any way, it seems like their session would be timed out by the time they got to the end of the video and tried to navigate to another page.

So, a couple of questions:

1. Is the assumption above true, or does having a video playing in the background count as "user activity"?
2. If video playback doesn't count as "user activity", then is there a way, given a current_user, to reset/refresh that user's timeout_in value?  We're hitting a controller update action periodically during playback, so if I could call something on current_user at that point, that would work too.  Just not sure if that's possible.

Thanks

Kenton

Lucas Mazza

unread,
Dec 5, 2014, 12:04:02 PM12/5/14
to plataforma...@googlegroups.com
The video playing in the user's browser won't count as activity, so your assumption that it will be signed out by timeout is true. You can have a controller that your JS code hits every 5 minutes or so to keep the user signed in, and you don't have do to any extra code for that - just visiting any controller will tell Devise to update the user 'last_request_at' timestamp that is stored in the user session.

--

---
You received this message because you are subscribed to the Google Groups "Devise" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages