diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-02-21 14:55:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-21 14:55:38 +0100 |
commit | 8603a075049a9e903b05e2370cf4c5ebfda1e703 (patch) | |
tree | b40c5b480848d0bd2c8fefdd5d80348d7a778551 /config | |
parent | 2e89067d216d5044ada14ad7a8919b686dfa0839 (diff) |
Fix error when trying to register (#17600)
Diffstat (limited to 'config')
-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 |