mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 09:42:46 +08:00
Fix expire_in method for unauthenticated user [SCI-7943] (#4983)
This commit is contained in:
parent
461d06dad9
commit
4515ab0a65
1 changed files with 2 additions and 0 deletions
|
@ -36,6 +36,8 @@ class Users::SessionsController < Devise::SessionsController
|
||||||
end
|
end
|
||||||
|
|
||||||
def expire_in
|
def expire_in
|
||||||
|
return render body: nil, status: :unauthorized if current_user.blank?
|
||||||
|
|
||||||
if current_user.remember_created_at.nil? || (current_user.remember_created_at + Devise.remember_for).past?
|
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
|
||||||
|
|
Loading…
Reference in a new issue