Skip to content

Commit

Permalink
fix for issues #999: HTTP_ACCEPT=*/* should redirect to the default l…
Browse files Browse the repository at this point in the history
…ocation
  • Loading branch information
ecarnevale committed Apr 29, 2011
1 parent 4fd866d commit 8e12ddf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/devise/failure_app.rb
Expand Up @@ -65,7 +65,9 @@ def i18n_message(default = nil)
end

def redirect_url
if request_format == :html
if [:html, :"*/*", "*/*"].include? request_format
#if is_navigational_format?
#if request_format == :html
send(:"new_#{scope}_session_path")
else
send(:"new_#{scope}_session_path", :format => request_format)
Expand Down
5 changes: 5 additions & 0 deletions test/failure_app_test.rb
Expand Up @@ -39,6 +39,11 @@ def call_failure(env_params={})
assert_equal 'http://test.host/users/sign_in', @response.second['Location']
end

test 'return to the default redirect location for wildcard requests' do
call_failure 'action_dispatch.request.formats' => nil, 'HTTP_ACCEPT' => '*/*'
assert_equal 'http://test.host/users/sign_in', @response.second['Location']
end

test 'uses the proxy failure message as symbol' do
call_failure('warden' => OpenStruct.new(:message => :test))
assert_equal 'test', @request.flash[:alert]
Expand Down

0 comments on commit 8e12ddf

Please sign in to comment.