OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/lib/open_project/authentication/session_expiry.rb

23 lines
613 B

module OpenProject
module Authentication
module SessionExpiry
def session_ttl_enabled?
Setting.session_ttl_enabled? && Setting.session_ttl.to_i >= 5
end
def session_ttl_minutes
Setting.session_ttl.to_i.minutes
end
def session_ttl_expired?
# Only when the TTL setting exists
return false unless session_ttl_enabled?
# If the session is rack-provided and empty, also skip it
return false if session.empty?
session[:updated_at].nil? || (session[:updated_at] + session_ttl_minutes) < Time.now
end
end
end
end