From: Martyn Taylor <mtaylor(a)redhat.com>
---
src/app/controllers/application_controller.rb | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/app/controllers/application_controller.rb
b/src/app/controllers/application_controller.rb
index cb4a1d3..c9b2949 100644
--- a/src/app/controllers/application_controller.rb
+++ b/src/app/controllers/application_controller.rb
@@ -212,10 +212,15 @@ class ApplicationController < ActionController::Base
end
def require_user
- return if current_user
- store_location
- flash[:notice] = "You must be logged in to access this page"
- redirect_to login_url
+ respond_to do |format|
+ format.html do
+ return if current_user
+ store_location
+ flash[:notice] = "You must be logged in to access this page"
+ redirect_to login_url
+ end
+ format.xml { head :unauthorized }
+ end
end
def require_no_user
--
1.7.4