mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-17 07:40:12 +01:00
Refactor session expire method
This commit is contained in:
parent
0e3000b2c5
commit
0150e9f2c3
1 changed files with 16 additions and 19 deletions
|
|
@ -45,12 +45,11 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
def set_session_expiration
|
def set_session_expiration
|
||||||
# http://wiki.rubyonrails.com/rails/show/HowtoChangeSessionOptions
|
# http://wiki.rubyonrails.com/rails/show/HowtoChangeSessionOptions
|
||||||
unless session == nil
|
|
||||||
return if self.controller_name == 'feed' or session['noexpiry'] == "on"
|
|
||||||
# If the method is called by the feed controller (which we don't have
|
# If the method is called by the feed controller (which we don't have
|
||||||
# under session control) or if we checked the box to keep logged in on
|
# under session control) or if we checked the box to keep logged in on
|
||||||
# login don't set the session expiry time.
|
# login don't set the session expiry time.
|
||||||
if session
|
return if session.nil? || self.controller_name == 'feed' || session['noexpiry'] == "on"
|
||||||
|
|
||||||
# Get expiry time (allow ten seconds window for the case where we have
|
# Get expiry time (allow ten seconds window for the case where we have
|
||||||
# none)
|
# none)
|
||||||
expiry_time = session['expiry_time'] || Time.now + 10
|
expiry_time = session['expiry_time'] || Time.now + 10
|
||||||
|
|
@ -62,8 +61,6 @@ class ApplicationController < ActionController::Base
|
||||||
session['expiry_time'] = Time.now + (60*60)
|
session['expiry_time'] = Time.now + (60*60)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Redirects to change_password_user_path if the current user uses a
|
# Redirects to change_password_user_path if the current user uses a
|
||||||
# deprecated password hashing algorithm.
|
# deprecated password hashing algorithm.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue