Sha256: 91f5a4df31f3685da3248fa8a0afd2dfa9decf11df9146db898a11ffa4be4689

Contents?: true

Size: 471 Bytes

Versions: 15

Compression:

Stored size: 471 Bytes

Contents

module Gluttonberg
  module Middleware
    class Honeypot

      def initialize(app, field_name)
        @app = app
        @field_name = field_name
      end

      def call(env)
        form_hash = env["rack.request.form_hash"]

        if form_hash && form_hash[@field_name] =~ /\S/
          [200, {'Content-Type' => 'text/html', "Content-Length" => "0"}, []]
        else
          @app.call(env)
        end
      end

    end
  end # Middleware
end # Gluttonberg

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gluttonberg-core-2.6.4 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.6.3 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.6.2 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.6.1 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.6.0 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.5.9 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.5.8 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.5.7 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.5.6 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.5.5 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.5.4 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.5.3 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.5.2 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.5.1 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-2.5 lib/gluttonberg/middleware/honeypot.rb