mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-06 15:40:31 +08:00
Fix session end for remember me
This commit is contained in:
parent
c4ba723998
commit
a2dbf79716
1 changed files with 3 additions and 2 deletions
|
@ -36,10 +36,11 @@ class Users::SessionsController < Devise::SessionsController
|
||||||
end
|
end
|
||||||
|
|
||||||
def expire_in
|
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
|
render plain: (Devise.timeout_in.to_i - (Time.now.to_i - user_session['last_request_at']).round) * 1000
|
||||||
else
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue