diff options
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 |