]> source.dussan.org Git - redmine.git/commitdiff
Fixed that #require_login should respond for other request types (#19325).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 10 Mar 2015 18:19:51 +0000 (18:19 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 10 Mar 2015 18:19:51 +0000 (18:19 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@14069 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/application_controller.rb
test/integration/application_test.rb

index 480dfb885451e5d4c229d138169bc7af9c04c63e..e52cc6186ed6476c9d0b9b4e40be3d6eac3ef27c 100644 (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
index befb8fb35c8677a89a5563acc5dea821d2499aa1..e01b44a728f54d5a93b86c6e9116703d52c90796 100644 (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