Skip to content

Commit

Permalink
Don't limit sign-in attempts on test environment
Browse files Browse the repository at this point in the history
Without this modification, the selenium tests often trigger a 429 / Too Many Requests error. (Perhaps this should be applied to "/users/password" as well?)
  • Loading branch information
aaronskiba committed Jan 31, 2024
1 parent 870ec65 commit 622705f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion config/initializers/rack_attack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@

# Throttle attempts to a particular path. 4 POSTs to /users/sign_in every 30 seconds
Rack::Attack.throttle "logins/ip", limit: 4, period: 30.seconds do |req|
req.post? && req.path == "/users/sign_in" && req.ip
# Don't apply sign-in rate-limiting to test environment
req.post? && req.path == "/users/sign_in" && req.ip unless Rails.env.test?
end

0 comments on commit 622705f

Please sign in to comment.