Fixed that #require_login should respond for other request types (#19325).

git-svn-id: http://svn.redmine.org/redmine/trunk@14069 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2015-03-10 18:19:51 +00:00
parent 7c9f3b5b43
commit e429d93945
2 changed files with 11 additions and 1 deletions

View File

@@ -243,10 +243,13 @@ class ApplicationController < ActionController::Base
redirect_to :controller => "account", :action => "login", :back_url => url
end
}
format.atom { redirect_to :controller => "account", :action => "login", :back_url => url }
format.any(:atom, :pdf, :csv) {
redirect_to :controller => "account", :action => "login", :back_url => url
}
format.xml { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' }
format.js { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' }
format.json { head :unauthorized, 'WWW-Authenticate' => 'Basic realm="Redmine API"' }
format.any { head :unauthorized }
end
return false
end

View File

@@ -87,4 +87,11 @@ class ApplicationTest < Redmine::IntegrationTest
ensure
ActionController::Base.allow_forgery_protection = false
end
def test_require_login_with_pdf_format_should_not_error
with_settings :login_required => '1' do
get '/issues/1.pdf'
assert_response 302
end
end
end