You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I logged in with remember_me option. And leaved tab opened for more that 1 hour. Then I reloaded page and was redirected to login page. Then I reloaded page again and I was logged in. So I started digging code and found this:
base.prepend_before_action :validate_session
def validate_session
session_to_use = Config.session_timeout_from_last_action ? session[:last_action_time] : session[:login_time]
if session_to_use && sorcery_session_expired?(session_to_use.to_time)
reset_sorcery_session
# USER IS DEFINED THERE
@current_user = nil
else
session[:last_action_time] = Time.now.in_time_zone
end
end
def current_user
unless defined?(@current_user)
# USER IS DEFINED SO THIS WILL BE SKIPPED IN CURRENT REQUEST
@current_user = login_from_session || login_from_other_sources || nil
end
@current_user
end
So maybe remove_instance_variable :@current_user if defined? @current_user will be better option. And IMHO this should be done everywhere where user is settled to nil.
And also I found this place. I don't understand the reason of that ELSE block:
I'm not very satisfied with my PR, because I think that check defined?(@current_user) inside current_user method is not very obvious solution. I would better rewrite that logic but I don't have enogh time to do it right and don't want to break something
I'm using such submodules:
I logged in with remember_me option. And leaved tab opened for more that 1 hour. Then I reloaded page and was redirected to login page. Then I reloaded page again and I was logged in. So I started digging code and found this:
sorcery/lib/sorcery/controller/submodules/session_timeout.rb
Line 38 in 4e3fcdb
sorcery/lib/sorcery/controller.rb
Line 82 in a873231
So maybe
remove_instance_variable :@current_user if defined? @current_user
will be better option. And IMHO this should be done everywhere where user is settled to nil.And also I found this place. I don't understand the reason of that ELSE block:
sorcery/lib/sorcery/controller/submodules/remember_me.rb
Line 70 in 4e3fcdb
The text was updated successfully, but these errors were encountered: