Avoid return within block (#17590)

This prevents the error: LocalJumpError (unexpected return)
This commit is contained in:
zunda 2022-02-18 19:21:21 +00:00 committed by GitHub
parent 1de2e3f980
commit f9e7f2e409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 3 deletions

View File

@ -82,9 +82,13 @@ class Rack::Attack
end end
throttle('throttle_sign_up_attempts/ip', limit: 25, period: 5.minutes) do |req| throttle('throttle_sign_up_attempts/ip', limit: 25, period: 5.minutes) do |req|
return unless req.post? && req.path == '/auth' if req.post? && req.path == '/auth'
return req.remote_ip.mask(64) if req.remote_ip.ipv6? if req.remote_ip.ipv6?
req.remote_ip req.remote_ip.mask(64)
else
req.remote_ip
end
end
end end
throttle('throttle_password_resets/ip', limit: 25, period: 5.minutes) do |req| throttle('throttle_password_resets/ip', limit: 25, period: 5.minutes) do |req|