Module: AutoSessionTimeout

Defined in:
lib/auto_session_timeout.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(controller) ⇒ Object



3
4
5
# File 'lib/auto_session_timeout.rb', line 3

def self.included(controller)
  controller.extend ClassMethods
end

Instance Method Details

#render_session_statusObject



27
28
29
30
# File 'lib/auto_session_timeout.rb', line 27

def render_session_status
  response.headers["Etag"] = nil  # clear etags to prevent caching
  render plain: !!current_user, status: 200
end

#render_session_timeoutObject



32
33
34
35
# File 'lib/auto_session_timeout.rb', line 32

def render_session_timeout
  flash[:notice] = t("devise.failure.timeout", default: "Your session has timed out.")
  redirect_to 
end