diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-02-21 15:46:53 +0100 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-02-21 15:46:53 +0100 |
commit | 2bd9bcf69888bca7f50fc1fb21d8237599e79521 (patch) | |
tree | 11b4fd1ddfe4323b880dd82f46fa35f89945927d /config/initializers | |
parent | 23a548d794b1cb5005428c6bcf73819c1944339e (diff) | |
parent | 8603a075049a9e903b05e2370cf4c5ebfda1e703 (diff) |
Merge branch 'main' into glitch-soc/merge-upstream
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/rack_attack.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index a1fea7712..c3733e377 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -83,11 +83,10 @@ class Rack::Attack throttle('throttle_sign_up_attempts/ip', limit: 25, period: 5.minutes) do |req| if req.post? && req.path == '/auth' - if req.remote_ip.ipv6? - req.remote_ip.mask(64) - else - req.remote_ip - end + addr = req.remote_ip + addr = IPAddr.new(addr) if addr.is_a?(String) + addr = addr.mask(64) if addr.ipv6? + addr.to_s end end |