Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
password protect any site without devise users
class AnyController < ApplicationController
# HTTP authentication should be used for staging to prevent unauthorized outside access to application.
before_filter :authenticate if Rails.env.staging?
private
def authenticate
authenticate_or_request_with_http_basic do |user,pass|
user == "usernamehere" && pass == "passwordhere"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.