Created
December 8, 2014 21:37
-
-
Save vcavallo/80f01ad6fb4b90993dfd to your computer and use it in GitHub Desktop.
password protect any site without devise users
This file contains 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
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