Skip to content
Snippets Groups Projects
Commit 352bae8c authored by ThibG's avatar ThibG Committed by Eugen Rochko
Browse files

Update session activation time (fixes #5605) (#7408)

parent b241cb27
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,7 @@ class ApplicationController < ActionController::Base
include Localized
include UserTrackingConcern
include SessionTrackingConcern
helper_method :current_account
helper_method :current_session
......
# frozen_string_literal: true
module SessionTrackingConcern
extend ActiveSupport::Concern
UPDATE_SIGN_IN_HOURS = 24
included do
before_action :set_session_activity
end
private
def set_session_activity
return unless session_needs_update?
current_session.touch
end
def session_needs_update?
!current_session.nil? && current_session.updated_at < UPDATE_SIGN_IN_HOURS.hours.ago
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment