Module: InvisibleCaptcha::ControllerHelpers

Defined in:
lib/invisible_captcha/controller_helpers.rb

Instance Method Summary collapse

Instance Method Details

#check_invisible_captchaObject



4
5
6
# File 'lib/invisible_captcha/controller_helpers.rb', line 4

def check_invisible_captcha
  head 200 if invisible_captcha?
end

#invisible_captcha?(fake_resource = nil, fake_field = nil) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
16
17
# File 'lib/invisible_captcha/controller_helpers.rb', line 8

def invisible_captcha?(fake_resource = nil, fake_field = nil)
  if fake_resource && fake_field
    return true if params[fake_resource][fake_field].present?
  else
    InvisibleCaptcha.fake_fields.each do |field|
      return true if params[field].present?
    end
  end
  false
end