Merge options hash instead of overwriting it

The forgetable hook will delete cookies based on the :scope in an
options hash but it was overwriting the options and setting them to
either an empty hash or a hash with a single :domain key. Because the
:scope was lost, the hook was trying to delete the 'remember__token'
instead of the more typical 'remember_user_token' cookie.
This commit is contained in:
Martin Davidsson 2010-09-24 08:44:21 +08:00 committed by Carlos Antonio da Silva
parent 589de27bcd
commit f3e348f6f4
1 changed files with 1 additions and 1 deletions

View File

@ -5,7 +5,7 @@
Warden::Manager.before_logout do |record, warden, options|
if record.respond_to?(:forget_me!)
record.forget_me! unless record.frozen?
options = record.cookie_domain? ? { :domain => record.cookie_domain } : {}
options = options.merge(record.cookie_domain? ? { :domain => record.cookie_domain } : {})
warden.cookies.delete("remember_#{options[:scope]}_token", options)
end
end