neerajdotname / session_expiration_management
- Source
- Commits
- Network (1)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
README.markdown | ||
| |
app/ | ||
| |
config/ | ||
| |
init.rb | ||
| |
lib/ | Sun Aug 23 11:03:56 -0700 2009 | |
| |
test/ | Sun Aug 23 08:37:38 -0700 2009 |
SessionExpirationManagement
Introduction
Most of the bank sites log you out or allow you to extend your session if you are inactive for a while. This plugin provides an opportunity to user to extend his/her session before logging the user out.
depends on
jQuery 1.3+
Rails 2.3
Why I am not using some sort of modal box
When I use modal box then set_Timeout function doest not work properly. Until I find out how to fix that, this is the best I could do.
How to install
ruby script/plugin install git://github.com/neerajdotname/session_expiration_management.git
Copy the javascript file to your application
cp vendor/plugins/session_expiration_management/lib/js/session_about_to_expire.js public/javascripts
Inside the head tag of your layout add following two lines
<%= javascript_include_tag 'session_about_to_expire' %> <%= trigger_session_expiration_watch %>
In application_controller.rb add followling line
manage_session_expiration(:logout_url => '/logout')
By default user will be logged out if user is inactive for 20 minuts. 2 minutes before that usre will be prompted to extend their session. If you want to override the default values then you can provide your values like this
manage_session_expiration(:logout_url => '/logout',
:keep_session_alive_for => 30.minutes,
:warn_user_when_time_left_is => 4.minutes)
Thie plugin assumes that view has access to method logged_in?. Usually I define this method like this in application_controller.rb
def logged_in? session[:user_id] end helper_method :logged_in?
Feedback
Email me: neerajdotname [at] gmail (dot) com
Author Blog
Source Code
http://github.com/neerajdotname/session_expiration_management
License
MIT
Copyright (c) 2009 neerajdotname

