Created
March 9, 2011 09:24
-
-
Save qichunren/861931 to your computer and use it in GitHub Desktop.
login from http basic authcation
This file contains hidden or 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 ApplicationController < ActionController::Base | |
USER_NAME, PASSWORD = "xx", "secret" | |
protect_from_forgery | |
before_filter :login_from_http_auth | |
protected | |
def login_from_http_auth | |
authenticate_or_request_with_http_basic do |user_name, password| | |
user_name == USER_NAME && password == PASSWORD | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment