mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-27 15:07:41 +00:00
README: clarify throttle example.
Don't use logical operators for control flow.
This commit is contained in:
parent
247835c63b
commit
f73fd1ab4e
1 changed files with 3 additions and 2 deletions
|
|
@ -102,8 +102,9 @@ A [Rack::Request](http://rack.rubyforge.org/doc/classes/Rack/Request.html) objec
|
||||||
end
|
end
|
||||||
|
|
||||||
# Throttle login attempts for a given email parameter to 6 reqs/minute
|
# Throttle login attempts for a given email parameter to 6 reqs/minute
|
||||||
|
# Return the email as a discriminator on POST /login requests
|
||||||
Rack::Attack.throttle('logins/email', :limit => 6, :period => 60.seconds) do |req|
|
Rack::Attack.throttle('logins/email', :limit => 6, :period => 60.seconds) do |req|
|
||||||
req.path == '/login' && req.post? && req.params['email']
|
req.params['email'] if req.path == '/login' && req.post?
|
||||||
end
|
end
|
||||||
|
|
||||||
### Tracks
|
### Tracks
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue