Skip to content

Commit

Permalink
Add warning when session is invalid (#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
EarlyZhao authored and huacnlee committed Jul 19, 2018
1 parent 7aa691d commit b6c3d37
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/rucaptcha/controller_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ module ControllerHelpers
# 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

Expand Down Expand Up @@ -73,5 +74,12 @@ def add_rucaptcha_validation_error
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

0 comments on commit b6c3d37

Please sign in to comment.