From 7ff0231ab723df2d75f5300524708dc85126ddac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Mon, 3 Jan 2011 16:24:07 +0100 Subject: [PATCH] Don't pass options forward, this fixes uncaught warden error. Unfortunately could not write a test for it, although easily reproducible in Rails applications. Closes #754 --- CHANGELOG.rdoc | 1 - lib/devise/hooks/activatable.rb | 5 +++-- lib/devise/hooks/timeoutable.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.rdoc b/CHANGELOG.rdoc index fad53c07..47fa22c8 100644 --- a/CHANGELOG.rdoc +++ b/CHANGELOG.rdoc @@ -4,7 +4,6 @@ * bug fix * Fix an issue causing infinite redirects in production * rails g destroy works properly with devise generators (by github.com/andmej) - * recall options is now passed forward by hooks (by github.com/siong1987) * before_failure callbacks should work on test helpers (by github.com/twinge) * rememberable cookie now is httponly by default (by github.com/JamesFerguson) diff --git a/lib/devise/hooks/activatable.rb b/lib/devise/hooks/activatable.rb index c6314f22..d2d86d41 100644 --- a/lib/devise/hooks/activatable.rb +++ b/lib/devise/hooks/activatable.rb @@ -4,7 +4,8 @@ # in each request and in case the user is using other strategies beside Devise ones. Warden::Manager.after_set_user do |record, warden, options| if record && record.respond_to?(:active?) && !record.active? - warden.logout(options[:scope]) - throw :warden, options.merge(:message => record.inactive_message) + scope = options[:scope] + warden.logout(scope) + throw :warden, :scope => scope, :message => record.inactive_message end end \ No newline at end of file diff --git a/lib/devise/hooks/timeoutable.rb b/lib/devise/hooks/timeoutable.rb index a323aafb..24422ee4 100644 --- a/lib/devise/hooks/timeoutable.rb +++ b/lib/devise/hooks/timeoutable.rb @@ -13,7 +13,7 @@ Warden::Manager.after_set_user do |record, warden, options| path_checker = Devise::PathChecker.new(warden.env, scope) unless path_checker.signing_out? warden.logout(scope) - throw :warden, options.merge(:message => :timeout) + throw :warden, :scope => scope, :message => :timeout end end