Fix session end for remember me

This commit is contained in:
Andrej 2022-11-30 12:03:27 +01:00
parent c4ba723998
commit a2dbf79716

View file

@ -36,10 +36,11 @@ class Users::SessionsController < Devise::SessionsController
end
def expire_in
if current_user.remember_created_at.nil?
if current_user.remember_created_at.nil? || (current_user.remember_created_at + Devise.remember_for).past?
render plain: (Devise.timeout_in.to_i - (Time.now.to_i - user_session['last_request_at']).round) * 1000
else
render plain: (Devise.remember_for - (Time.now.to_i - current_user.remember_created_at.to_i).round) * 1000
render plain: [(Devise.remember_for - (Time.now.to_i - current_user.remember_created_at.to_i).round) * 1000,
(Devise.timeout_in.to_i - (Time.now.to_i - user_session['last_request_at']).round) * 1000].max
end
end