From b6c3d3735dc2d394e7afd0210d9d1bbe19808acf Mon Sep 17 00:00:00 2001 From: EarlyZhao Date: Thu, 19 Jul 2018 13:54:36 +0800 Subject: [PATCH] Add warning when session is invalid (#66) --- lib/rucaptcha/controller_helpers.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/rucaptcha/controller_helpers.rb b/lib/rucaptcha/controller_helpers.rb index fe187e3..4061f2a 100644 --- a/lib/rucaptcha/controller_helpers.rb +++ b/lib/rucaptcha/controller_helpers.rb @@ -9,6 +9,7 @@ module RuCaptcha # session key of rucaptcha def rucaptcha_sesion_key_key session_id = session.respond_to?(:id) ? session.id : session[:session_id] + warning_when_session_invalid if session_id.blank? ['rucaptcha-session', session_id].join(':') end @@ -73,5 +74,12 @@ module RuCaptcha end false end + + def warning_when_session_invalid + Rails.logger.warn " + WARNING! The session.id is blank, RuCaptcha can't work properly, please keep session available. + More details about this: https://github.com/huacnlee/rucaptcha/pull/66 + " + end end end