Merge pull request #5306 from janz93/cleanup

Add to-do to cleanup rack/rails session bug fix when supporting Rails 5.2+ only
This commit is contained in:
Carlos Antonio da Silva
2020-11-22 21:42:48 -03:00
committed by GitHub

View File

@@ -106,10 +106,12 @@ module Devise
private
def expire_data_after_sign_in!
# TODO: remove once Rails 5.2+ and forward are only supported.
# session.keys will return an empty array if the session is not yet loaded.
# This is a bug in both Rack and Rails.
# A call to #empty? forces the session to be loaded.
session.empty?
session.keys.grep(/^devise\./).each { |k| session.delete(k) }
end