diff --git a/lib/rucaptcha/controller_helpers.rb b/lib/rucaptcha/controller_helpers.rb index e46cd8d..27c5646 100644 --- a/lib/rucaptcha/controller_helpers.rb +++ b/lib/rucaptcha/controller_helpers.rb @@ -18,8 +18,8 @@ module RuCaptcha end def verify_rucaptcha?(resource = nil) - params[:_rucaptcha] ||= '' - right = params[:_rucaptcha].downcase.strip == session[:_rucaptcha] + right = params[:_rucaptcha].present? and session[:_rucaptcha].present? and + params[:_rucaptcha].downcase.strip == session[:_rucaptcha] if resource && resource.respond_to?(:errors) resource.errors.add(:base, t('rucaptcha.invalid')) unless right end