Skip to content

Instantly share code, notes, and snippets.

@bradediger
Created February 24, 2009 21:33
Show Gist options
  • Save bradediger/69798 to your computer and use it in GitHub Desktop.
Save bradediger/69798 to your computer and use it in GitHub Desktop.
def login_required
authorized? || access_denied
end
def access_denied
respond_to do |format|
format.html do
store_location
redirect_to new_session_path
end
# format.any doesn't work in rails version < http://dev.rubyonrails.org/changeset/8987
# you may want to change format.any to e.g. format.any(:js, :xml)
format.any do
request_http_basic_authentication 'Web Password'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment