Sha256: 3b8de35c28302517762fce5649437c00ba51d1b0d4b8fc10e5383c151a4161b1

Contents?: true

Size: 469 Bytes

Versions: 3

Compression:

Stored size: 469 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

3 entries across 3 versions & 1 rubygems

Version Path
gluttonberg-core-3.0.2 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-3.0.1 lib/gluttonberg/middleware/honeypot.rb
gluttonberg-core-3.0.0 lib/gluttonberg/middleware/honeypot.rb