diff options
author | Francis Irving <francis@mysociety.org> | 2009-12-22 15:47:34 +0000 |
---|---|---|
committer | Francis Irving <francis@mysociety.org> | 2009-12-22 15:47:34 +0000 |
commit | b198fe678622b194ce93a531441490fce411b8f3 (patch) | |
tree | 01e3477643576e0845dc6873ab426d8eaaf561f7 /app/controllers/application_controller.rb | |
parent | 13a07144187b30a96e2a2fd1264f010cd1d2fd2a (diff) |
Fix remember me.
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 5055519ec..1addc5bab 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -40,21 +40,12 @@ class ApplicationController < ActionController::Base before_filter :session_remember_me def session_remember_me # Reset the "sliding window" session expiry time. - if session[:remember_me] - expire_time = 1.month.from_now - # "Why is session[:force_new_cookie] set to Time.now? In order for the “sliding window” - # concept to work, a fresh cookie must be sent with every response. Rails only - # sends a cookie when the session data has changed so using a value like Time.now - # ensures that it changes every time. What I have actually found is that some - # internal voodoo causes the session data to change slightly anyway but it’s best - # to be sure!" - session[:force_new_cookie] = Time.now - else - expire_time = nil - end - # if statement here is so test code runs - if session.instance_variable_get(:@dbman) - session.instance_variable_get(:@dbman).instance_variable_get(:@cookie_options)['expires'] = expire_time + if request.env['rack.session.options'] + if session[:remember_me] + request.env['rack.session.options'][:expire_after] = 1.month + else + request.env['rack.session.options'][:expire_after] = nil + end end end |