Commit 6a5c9a59b3d79af19b468281943d26ed8333b6f9
1 parent
62221a7d
Exists in
master
and in
22 other branches
Do not redirect AJAX requests
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
lib/authenticated_system.rb
@@ -64,8 +64,12 @@ module AuthenticatedSystem | @@ -64,8 +64,12 @@ module AuthenticatedSystem | ||
64 | def access_denied | 64 | def access_denied |
65 | respond_to do |accepts| | 65 | respond_to do |accepts| |
66 | accepts.html do | 66 | accepts.html do |
67 | - store_location | ||
68 | - redirect_to :controller => '/account', :action => 'login' | 67 | + if request.xhr? |
68 | + render :text => _('Access denied'), :status => 401 | ||
69 | + else | ||
70 | + store_location | ||
71 | + redirect_to :controller => '/account', :action => 'login' | ||
72 | + end | ||
69 | end | 73 | end |
70 | accepts.xml do | 74 | accepts.xml do |
71 | headers["Status"] = "Unauthorized" | 75 | headers["Status"] = "Unauthorized" |