about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-02-19 11:33:18 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-02-19 11:33:18 +0100
commitdc121b609f25dcfd39b10dfcc69da95a3a63ff12 (patch)
tree5e5e43faa68f1b6320f48d8d5c724d91873ae962 /config/initializers
parentc8ef003c6b40e9b7212f43f1b5706b0967fcfe8a (diff)
parent2e89067d216d5044ada14ad7a8919b686dfa0839 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/rack_attack.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb
index 964d4266d..a1fea7712 100644
--- a/config/initializers/rack_attack.rb
+++ b/config/initializers/rack_attack.rb
@@ -82,7 +82,13 @@ class Rack::Attack
   end
 
   throttle('throttle_sign_up_attempts/ip', limit: 25, period: 5.minutes) do |req|
-    req.remote_ip if req.post? && req.path == '/auth'
+    if req.post? && req.path == '/auth'
+      if req.remote_ip.ipv6?
+        req.remote_ip.mask(64)
+      else
+        req.remote_ip
+      end
+    end
   end
 
   throttle('throttle_password_resets/ip', limit: 25, period: 5.minutes) do |req|