Created
April 13, 2010 19:35
-
-
Save knzai/364997 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def anon_access_denied | |
respond_to do |accepts| | |
accepts.html do | |
store_location | |
redirect_to login_path | |
end | |
accepts.xml do | |
headers["Status"] = "Unauthorized" | |
headers["WWW-Authenticate"] = %(Basic realm="Web Password") | |
render :text => "Could't authenticate you", :status => '401 Unauthorized' | |
end | |
accepts.js do | |
render(:update) { |page| page.redirect_to login_path } | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def anon_access_denied | |
respond_to do |accepts| | |
accepts.html do | |
store_location | |
redirect_to login_path | |
end | |
accepts.xml do | |
headers["Status"] = "Unauthorized" | |
headers["WWW-Authenticate"] = %(Basic realm="Web Password") | |
render :text => "Could't authenticate you", :status => '401 Unauthorized' | |
end | |
accepts.js do | |
render(:update) { |page| page.redirect_to login_path } | |
end | |
accepts.any do | |
store_location | |
redirect_to login_path | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment