Skip to content

Instantly share code, notes, and snippets.

@jswanner
Created June 22, 2012 18:01
Show Gist options
  • Save jswanner/2974260 to your computer and use it in GitHub Desktop.
Save jswanner/2974260 to your computer and use it in GitHub Desktop.
Basic auth for certain RefineryCMS page.
module MyApplication
class Application < Rails::Application
config.to_prepare do
Refinery::PagesController.class_eval do
before_filter :require_auth, :only => [:show]
def require_auth
if params[:id] == 'secret-page'
authenticate_or_request_with_http_basic('Administration') do |username, password|
username == 'admin' && password == 'password'
end
end
end
protected :require_auth
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment