app/controllers/application_controller.rb
def authenticate_admin
    valid_user = authenticate_with_http_basic { |u, p| u == SETTINGS['admin_username'] && p == SETTINGS['admin_password'] }
    if valid_user
      return true
    else
      request_http_basic_authentication
    end
  end
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception.
For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception . For APIs you may want to use : null_session instead .
def authenticate_admin
    valid_user = authenticate_with_http_basic { |u, p| u == SETTINGS['admin_username'] && p == SETTINGS['admin_password'] }
    if valid_user
      return true
    else
      request_http_basic_authentication
    end
  end
def authenticate_admin valid_user = authenticate_with_http_basic { | u , p | u == SETTINGS [ 'admin_username' ] && p == SETTINGS [ 'admin_password' ] } if valid_user return true else request_http_basic_authentication end end
Prevent CSRF attacks by raising an exception.
Prevent CSRF attacks by raising an exception .