Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails/Devise - Determining when user session will expire

When using the timeoutable module for Devise, how can one determine how long it will be before the current user's session expires? The goal is to include this value in all responses so client side script can make use of it. I gather that Devise internally uses Warden for authentication, but I haven't found anything that explains how to pull the session expiration time out of the depths of Warden.

like image 465
cbmanica Avatar asked May 22 '13 00:05

cbmanica


1 Answers

Here is how you do it:

class User < ActiveRecord::Base
  devise :authenticatable, :timeoutable, :validatable, :timeout_in => 20.minutes
end
like image 157
Benjamin Tan Wei Hao Avatar answered Sep 23 '22 06:09

Benjamin Tan Wei Hao