2010-04-06 10:34:22 -04:00
|
|
|
# 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
|
2011-04-21 11:29:15 -04:00
|
|
|
# remembered again. Notice that we forget the user unless the record is not persisted.
|
2010-04-06 10:34:22 -04:00
|
|
|
# This avoids forgetting deleted users.
|
2010-05-05 13:25:59 -04:00
|
|
|
Warden::Manager.before_logout do |record, warden, options|
|
2010-04-06 10:34:22 -04:00
|
|
|
if record.respond_to?(:forget_me!)
|
2011-02-24 15:55:41 -05:00
|
|
|
Devise::Controllers::Rememberable::Proxy.new(warden).forget_me(record)
|
2010-04-06 10:34:22 -04:00
|
|
|
end
|
2010-05-05 13:25:59 -04:00
|
|
|
end
|