Skip to content

Instantly share code, notes, and snippets.

View sandover's full-sized avatar

Brandon Harvey sandover

  • Magnopus
  • Los Angeles, CA
View GitHub Profile
def authenticate
authenticate_or_request_with_http_basic do | username,password |
return false if username.blank? || password.blank?
username.strip!.downcase!
# Check to see if this request provides a session cookie.
# If the user id is in the session database, they pass right thru
@current_user = User.find_by_username( session[:user_id] ) if session[:user_id]
return if @current_user