Skip to content

pstuteville/sliding_session_timeout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SidingSessionTimeout
=====================

By default, sessions in Rails expire at a fixed time from the moment 
they are created.  This plugin lets you configure your sessions to 
expire in a sliding window, a fixed time from the last page view.

Usage:
  # the macro for use in controllers
  sliding_session_timeout seconds [, upon_expiry_function]
	
  'seconds' is the time in seconds for a session to live
  'upon_expiry_function' is an optional method to call when a session dies
	  
	- ActionController::Base.reset_session will be called unless an expiry function is defined
	
Examples:
  # in app/controllers/application.rb
  
  # expire in thirty minutes
  sliding_session_timeout 60 * 30
  
  # or use Rails' number helpers
  sliding_session_timeout 30.minutes
  
  # expire in two hours and call the 'logout' method upon expiry
  sliding_session_timeout 2.hours, :logout
  
  def logout
    # do stuff here for logout
    reset_session
  end

http://github.com/pstuteville/sliding_session_timeout
Original plugin:  www.elctech.com/projects/sliding-session-timeout-plugin

About

A rails plugin that implements sliding session timeouts

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published