From 8603a075049a9e903b05e2370cf4c5ebfda1e703 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 21 Feb 2022 14:55:38 +0100 Subject: Fix error when trying to register (#17600) --- config/initializers/rack_attack.rb | 9 ++++----- 1 file 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 -- cgit