Merge pull request #2663 from scaryzet/fix_expire_session_data_after_sign_in

Fix expire_session_data_after_sign_in!
This commit is contained in:
José Valim 2013-10-03 08:40:04 -07:00
commit 9281ac3958
1 changed files with 4 additions and 0 deletions

View File

@ -258,6 +258,10 @@ module Devise
end
def expire_session_data_after_sign_in!
# 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