Created
March 26, 2009 14:05
-
-
Save RSpace/86115 to your computer and use it in GitHub Desktop.
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
def authenticate_or_request_admin | |
logged_in_as_admin || authenticate_or_request_with_http_basic { |username, password| login_as_admin(username, password) } | |
end | |
def logged_in_as_admin | |
session_enabled? && session[:is_admin?] | |
end | |
def login_as_admin(username, password) | |
authentic = username == ApplicationSettings::Administration::Authentication::USERNAME && | |
password == ApplicationSettings::Administration::Authentication::PASSWORD | |
session[:is_admin?] = true if authentic && session_enabled? | |
authentic | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment