mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-27 15:07:41 +00:00
Don't make README examples depend on activesupport
This commit is contained in:
parent
9f79ab272e
commit
16af283d28
1 changed files with 2 additions and 2 deletions
|
|
@ -187,7 +187,7 @@ 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
|
# 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) do |req|
|
||||||
req.params['email'] if req.path == '/login' && req.post?
|
req.params['email'] if req.path == '/login' && req.post?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -209,7 +209,7 @@ Rack::Attack.track("special_agent") do |req|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Supports optional limit and period, triggers the notification only when the limit is reached.
|
# Supports optional limit and period, triggers the notification only when the limit is reached.
|
||||||
Rack::Attack.track("special_agent", limit: 6, period: 60.seconds) do |req|
|
Rack::Attack.track("special_agent", limit: 6, period: 60) do |req|
|
||||||
req.user_agent == "SpecialAgent"
|
req.user_agent == "SpecialAgent"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue