diff --git a/lib/authenticated_system.rb b/lib/authenticated_system.rb index 161eaa7..04826ee 100644 --- a/lib/authenticated_system.rb +++ b/lib/authenticated_system.rb @@ -64,8 +64,12 @@ module AuthenticatedSystem def access_denied respond_to do |accepts| accepts.html do - store_location - redirect_to :controller => '/account', :action => 'login' + if request.xhr? + render :text => _('Access denied'), :status => 401 + else + store_location + redirect_to :controller => '/account', :action => 'login' + end end accepts.xml do headers["Status"] = "Unauthorized" -- libgit2 0.21.2