aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/admin_controller.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-07-12 11:49:58 +0100
committerSeb Bacon <seb.bacon@gmail.com>2011-07-12 11:49:58 +0100
commitb514aecf08384f3839db5cdb2274d3748a4402a2 (patch)
tree5354df8cce23f043bc4cbfac0cdcfc24989550a4 /app/controllers/admin_controller.rb
parent0d630ab2c87d925d27879c1cc0db55b0286e46d6 (diff)
parentd5ae493074fa3b71ba517ce34525402f5e59eff0 (diff)
merge IZ/Kosovo fork and refactor
Diffstat (limited to 'app/controllers/admin_controller.rb')
-rw-r--r--app/controllers/admin_controller.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 004d460c5..8598091d9 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -10,7 +10,7 @@ require 'fileutils'
class AdminController < ApplicationController
layout "admin"
- before_filter :assign_http_auth_user
+ before_filter :authenticate
protect_from_forgery # See ActionController::RequestForgeryProtection for details
# action to take if expecting an authenticity token and one isn't received
@@ -44,5 +44,15 @@ class AdminController < ApplicationController
expire_for_request(info_request)
end
end
+ private
+ def authenticate
+ username = MySociety::Config.get('ADMIN_USERNAME', '')
+ password = MySociety::Config.get('ADMIN_PASSWORD', '')
+ if !(username && password).empty?
+ authenticate_or_request_with_http_basic do |user_name, password|
+ user_name == username && password == password
+ end
+ end
+ end
end