Sha256: cd6835e2cf90dfdce000202d120613f6eaf9defad65b59aea94e48eccde598a1

Contents?: true

Size: 368 Bytes

Versions: 6

Compression:

Stored size: 368 Bytes

Contents

class Rack::Attack
  # Throttle POST requests to /reviews by email address
  #
  # Key: "rack::attack:#{Time.now.to_i/:period}:reviews/email:#{req.email}"
  throttle('reviews/email', limit: 2, period: 2.minutes) do |req|
    if req.path == '/reviews' && req.post?
      # return the email if present, nil otherwise
      req.params['email'].presence
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
workarea-reviews-3.1.2 config/initializers/rack_attack.rb
workarea-reviews-3.1.1 config/initializers/rack_attack.rb
workarea-reviews-3.1.0 config/initializers/rack_attack.rb
workarea-reviews-3.0.10 config/initializers/rack_attack.rb
workarea-reviews-3.0.9 config/initializers/rack_attack.rb
workarea-reviews-3.0.8 config/initializers/rack_attack.rb