Sha256: e8eab6cca455532fc98b0db404701d6f9bddb5c368ea15683816bd62b6d90410

Contents?: true

Size: 940 Bytes

Versions: 2

Compression:

Stored size: 940 Bytes

Contents

require 'invisible_captcha/version'
require 'invisible_captcha/controller_ext'
require 'invisible_captcha/view_helpers'
require 'invisible_captcha/form_helpers'
require 'invisible_captcha/validator'
require 'invisible_captcha/railtie'

module InvisibleCaptcha
  class << self
    attr_accessor :sentence_for_humans, :error_message, :honeypots, :visual_honeypots

    def init!
      # Default sentence for real users if text field was visible
      self.sentence_for_humans = 'If you are a human, ignore this field'

      # Default error message for validator
      self.error_message = 'You are a robot!'

      # Default fake fields for controller based workflow
      self.honeypots = ['foo_id', 'bar_id', 'baz_id']

      # Make honeypots visibles
      self.visual_honeypots = false
    end

    def setup
      yield(self) if block_given?
    end

    def get_honeypot
      honeypots.sample
    end
  end
end

InvisibleCaptcha.init!

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
invisible_captcha-0.8.0 lib/invisible_captcha.rb
invisible_captcha-0.7.0 lib/invisible_captcha.rb