From 47a7bcaa31a5289462bd0fe352ef51fd467dff4a Mon Sep 17 00:00:00 2001 From: xianbo Date: Thu, 28 Nov 2013 09:36:46 +0800 Subject: [PATCH] add every user_agent infomation to production.log --- app/controllers/application_controller.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 096eddf97..011be3171 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -42,7 +42,7 @@ class ApplicationController < ActionController::Base end before_filter :session_expiration, :user_setup, :check_if_login_required, :set_localization - + before_filter :user_agent rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token rescue_from ::Unauthorized, :with => :deny_access @@ -51,7 +51,10 @@ class ApplicationController < ActionController::Base include Redmine::Search::Controller include Redmine::MenuManager::MenuController helper Redmine::MenuManager::MenuHelper - + + def user_agent + logger.info "HTTP_USER_AGENT #{request.env["HTTP_USER_AGENT"]}" + end def session_expiration if session[:user_id] @@ -65,6 +68,7 @@ class ApplicationController < ActionController::Base end end + def session_expired? if Setting.session_lifetime? unless session[:ctime] && (Time.now.utc.to_i - session[:ctime].to_i <= Setting.session_lifetime.to_i * 60)