diff options
author | David Cabo <david@calibea.com> | 2011-10-13 00:31:56 +0200 |
---|---|---|
committer | David Cabo <david@calibea.com> | 2011-10-13 00:31:56 +0200 |
commit | 6b19c36f114624d7e53be8edc9ee490ecd20d0b0 (patch) | |
tree | 7741c3655fe5e3cbc90dd20a4626ac7acc1bf6b0 /app/controllers/admin_controller.rb | |
parent | 6800b9ff3fc77aa441afbdb0b0196afbdd87d8b4 (diff) | |
parent | e13127a8ebc8bf8379d92f778af5a2bb6931d80c (diff) |
Merge branch 'release/0.4' into develop
Diffstat (limited to 'app/controllers/admin_controller.rb')
-rw-r--r-- | app/controllers/admin_controller.rb | 14 |
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 |