Sha256: d8819984674152ee48fe45418c95b72908ced1a17bd68177bcac6546004f51ff
Contents?: true
Size: 768 Bytes
Versions: 2
Compression:
Stored size: 768 Bytes
Contents
require 'zero-captcha/form_tag_helper' module ZeroCaptcha module SpamProtection def zero_captcha_fields { :_zc_field => '5b5cd0da3121fc53b4bc84d0c8af2e81' } # change this in controller by overriding `zero_captcha_fields` end def protect_from_spam_with_zero_captcha head :ok if zero_captcha_fields.any? { |name, value| params[name] && params[name] != value } end def self.included(base) # :nodoc: base.send :helper_method, :zero_captcha_fields if base.respond_to? :before_filter base.send :prepend_before_filter, :protect_from_spam_with_zero_captcha, :only => [:create, :update] end end end end ActionController::Base.send(:include, ZeroCaptcha::SpamProtection) if defined?(ActionController::Base)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zero-captcha-0.0.2 | lib/zero-captcha.rb |
zero-captcha-0.0.1 | lib/zero-captcha.rb |