basic authentication

pull/1/head
Jared Cosulich 8 years ago
parent f6e88b3ff6
commit aa5f1ad157

@ -9,4 +9,10 @@ class ApplicationController < ActionController::Base
return false return false
end end
def authenticate(username, password)
authenticate_or_request_with_http_basic do |u, p|
u == username && p == password
end
end
end end

@ -11,6 +11,8 @@ class CategoriesController < ApplicationController
# GET /categories/1 # GET /categories/1
# GET /categories/1.json # GET /categories/1.json
def show def show
district = @school.district
authenticate(district.name.downcase, "#{district.name.downcase}!")
@school_category = SchoolCategory.for(@school, @category).first @school_category = SchoolCategory.for(@school, @category).first
@child_school_categories = SchoolCategory.for_parent_category(@school, @category) @child_school_categories = SchoolCategory.for_parent_category(@school, @category)
@questions = @category.questions @questions = @category.questions

@ -10,6 +10,7 @@ class DistrictsController < ApplicationController
# GET /districts/1 # GET /districts/1
# GET /districts/1.json # GET /districts/1.json
def show def show
authenticate(@district.name.downcase, "#{@district.name.downcase}!")
@schools = @district.schools.alphabetic @schools = @district.schools.alphabetic
end end

@ -7,6 +7,8 @@ class SchoolsController < ApplicationController
# GET /schools/1 # GET /schools/1
# GET /schools/1.json # GET /schools/1.json
def show def show
district = @school.district
authenticate(district.name.downcase, "#{district.name.downcase}!")
@school_categories = @school.school_categories.for_parent_category(@school, nil).sort @school_categories = @school.school_categories.for_parent_category(@school, nil).sort
end end

@ -31,7 +31,7 @@ class Category < ApplicationRecord
"academic-learning", "academic-learning",
"citizenship-and-wellbeing", "citizenship-and-wellbeing",
"pilot-family-questions" "pilot-family-questions"
].index(root_identifier) ].index(root_identifier) || 0
end end
end end

Loading…
Cancel
Save