aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/admin_controller.rb
diff options
context:
space:
mode:
authorseb <seb@seb-U36JC>2011-11-24 09:21:36 +0000
committerseb <seb@seb-U36JC>2011-11-24 09:21:36 +0000
commita4e533f1588a5d34dca4ab462b58ddd83eed37c5 (patch)
tree58bb3b57ec5664e094ae151c18b6c1915256e364 /app/controllers/admin_controller.rb
parentd473fce1d0451c913d3ef697d3b45bd58c6fff54 (diff)
parente649c2a7f19d0a75206149d886ff47b3ccda4e91 (diff)
Merge branch 'develop' into xapian-dcabo
Conflicts: spec/models/xapian_spec.rb
Diffstat (limited to 'app/controllers/admin_controller.rb')
-rw-r--r--app/controllers/admin_controller.rb15
1 files changed, 10 insertions, 5 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 655670b5a..adb506b91 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -45,13 +45,18 @@ class AdminController < ApplicationController
end
end
private
+
def authenticate
- username = MySociety::Config.get('ADMIN_USERNAME', '')
- password = MySociety::Config.get('ADMIN_PASSWORD', '')
- if !username.empty? && !password.empty?
+ config_username = MySociety::Config.get('ADMIN_USERNAME', '')
+ config_password = MySociety::Config.get('ADMIN_PASSWORD', '')
+ if !config_username.empty? && !config_password.empty?
authenticate_or_request_with_http_basic do |user_name, password|
- user_name == username && password == password
- session[:using_admin] = 1
+ if user_name == config_username && password == config_password
+ session[:using_admin] = 1
+ request.env['REMOTE_USER'] = user_name
+ else
+ request_http_basic_authentication
+ end
end
else
session[:using_admin] = 1