mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
f3e348f6f4
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.
11 lines
581 B
Ruby
11 lines
581 B
Ruby
# Before logout hook to forget the user in the given scope, if it responds
|
|
# to forget_me! Also clear remember token to ensure the user won't be
|
|
# remembered again. Notice that we forget the user unless the record is frozen.
|
|
# This avoids forgetting deleted users.
|
|
Warden::Manager.before_logout do |record, warden, options|
|
|
if record.respond_to?(:forget_me!)
|
|
record.forget_me! unless record.frozen?
|
|
options = options.merge(record.cookie_domain? ? { :domain => record.cookie_domain } : {})
|
|
warden.cookies.delete("remember_#{options[:scope]}_token", options)
|
|
end
|
|
end
|