aboutsummaryrefslogtreecommitdiffstats
path: root/app/controllers/admin_controller.rb
diff options
context:
space:
mode:
authorSeb Bacon <seb.bacon@gmail.com>2011-10-10 13:21:22 +0100
committerSeb Bacon <seb.bacon@gmail.com>2011-10-10 13:21:22 +0100
commit189c7c80c9e56d09d8dd441a924d687aa2b9ed5e (patch)
tree8aac4844a602458276b8d61f8482b31bae865d67 /app/controllers/admin_controller.rb
parent247a24cde3954b7f7b3cbb2e3b624669b6e6e61d (diff)
parentf6b93d8cb5fbe4e4d2c96bf732f76102d54ce9cd (diff)
Merge branch 'release/0.4' into develop
Diffstat (limited to 'app/controllers/admin_controller.rb')
-rw-r--r--app/controllers/admin_controller.rb14
1 files changed, 9 insertions, 5 deletions
diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb
index 655670b5a..0bfbcd3d1 100644
--- a/app/controllers/admin_controller.rb
+++ b/app/controllers/admin_controller.rb
@@ -45,13 +45,17 @@ 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
+ else
+ request_http_basic_authentication
+ end
end
else
session[:using_admin] = 1