Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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