Q:

Show users a message before they are logged out by timeout

We have a Rails 4 app using Devise for authentication. We want to:

Send the user a message 1 minute before his/her session automatically expires
Let the user click a button on this message to continue his/her session
Automatically send the user to the login page and display a message there if his/her session does expire

Are there any Devise extensions or build-in components that will help us do this, or will we need to roll our own solution? If we start on our own, are there any good tutorials for accomplishing this or documentation on the Devise hooks we'll likely be interacting with?

A:

It looks like as of when I wrote this answer, there weren't any gems or Devise hooks to take care of this for me, so I had to roll out my own component.
One of the most difficult parts of writing the component was figuring out how to send a request to the server to check how much longer the user had before being automatically logged out. I didn't want sending that request to reset the auto-log-out "timer." This question explains how I dealt with that task: Devise - Make a request without resetting the countdown until a user is logged out due to inactivity

