OSDN Git Service

basic認証、メッセージの日本語化
[praisedb/praisedb.git] / app / controllers / application_controller.rb
index 6635a3f..f4ce653 100644 (file)
@@ -4,7 +4,14 @@
 class ApplicationController < ActionController::Base
   helper :all # include all helpers, all the time
   protect_from_forgery # See ActionController::RequestForgeryProtection for details
+  before_filter :authenticate
 
   # Scrub sensitive parameters from your log
   # filter_parameter_logging :password
+
+  def authenticate
+    authenticate_or_request_with_http_basic do |user_name, password|
+      user_name == AppConfig.user_name && password == AppConfig.password
+    end
+  end
 end