Commit 6a5c9a59b3d79af19b468281943d26ed8333b6f9
1 parent
62221a7d
Exists in
staging
and in
42 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 | 64 | def access_denied |
| 65 | 65 | respond_to do |accepts| |
| 66 | 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 | 73 | end |
| 70 | 74 | accepts.xml do |
| 71 | 75 | headers["Status"] = "Unauthorized" | ... | ... |