Skip to content

Commit

Permalink
Fix infinite redirect issues. Closes heartcombo#787 and closes heartc…
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jan 20, 2011
1 parent c78bb68 commit 0615c0a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/devise/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def after_update_path_for(resource)
# We need to use a copy because we don't want actions like update changing
# the current user in place.
def authenticate_scope!
send(:"authenticate_#{resource_name}!")
send(:"authenticate_#{resource_name}!", true)
self.resource = resource_class.to_adapter.get!(send(:"current_#{resource_name}").to_key)
end
end
4 changes: 2 additions & 2 deletions lib/devise/controllers/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def self.define_helpers(mapping) #:nodoc:
mapping = mapping.name

class_eval <<-METHODS, __FILE__, __LINE__ + 1
def authenticate_#{mapping}!
warden.authenticate!(:scope => :#{mapping})
def authenticate_#{mapping}!(force = false)
warden.authenticate!(:scope => :#{mapping}) if !devise_controller? || force
end
def #{mapping}_signed_in?
Expand Down
2 changes: 0 additions & 2 deletions lib/devise/controllers/internal_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ module InternalHelpers #:nodoc:

prepend_before_filter :is_devise_resource?
respond_to *Mime::SET.map(&:to_sym) if mimes_for_respond_to.empty?

skip_before_filter *Devise.mappings.keys.map { |m| :"authenticate_#{m}!" }
end

# Gets the actual resource stored in the instance variable
Expand Down
5 changes: 5 additions & 0 deletions test/rails_app/config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,10 @@ class Application < Rails::Application
config.filter_parameters << :password

config.action_mailer.default_url_options = { :host => "localhost:3000" }

# This was used to break devise in some situations
config.to_prepare do
Devise::SessionsController.layout "application"
end
end
end

0 comments on commit 0615c0a

Please sign in to comment.