Compare commits

...

3 Commits

Author SHA1 Message Date
José Valim
9f763d082a Bump version. 2011-04-29 14:13:35 +02:00
José Valim
c62915e2bd Refactor. 2011-04-29 14:12:29 +02:00
Emanuel Carnevale
6153a52e2d fix for issues #999: HTTP_ACCEPT=*/* should redirect to the default location 2011-04-29 14:12:22 +02:00
4 changed files with 16 additions and 2 deletions

View File

@@ -1,3 +1,8 @@
== 1.3.4
* bug fix
* Do not add formats if html or "*/*"
== 1.3.3
* bug fix

View File

@@ -65,13 +65,17 @@ module Devise
end
def redirect_url
if request_format == :html
if skip_format?
send(:"new_#{scope}_session_path")
else
send(:"new_#{scope}_session_path", :format => request_format)
end
end
def skip_format?
%w(html */*).include? request_format.to_s
end
# Choose whether we should respond in a http authentication fashion,
# including 401 and optional headers.
#

View File

@@ -1,3 +1,3 @@
module Devise
VERSION = "1.3.3".freeze
VERSION = "1.3.4".freeze
end

View File

@@ -39,6 +39,11 @@ class FailureTest < ActiveSupport::TestCase
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]