about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorStarfall <us@starfall.systems>2022-02-25 12:35:11 -0600
committerStarfall <us@starfall.systems>2022-02-25 12:35:11 -0600
commitad1733ea294c6049336a9aeeb7ff96c8fea22cfa (patch)
tree306ff2d36a8bce82039890c4327f7d7bf37583dc /config/initializers
parentc5f289e8ef7ec1592d068ac797add7332343820d (diff)
parente48eaf64cc7cb0cfab388331c4823ee5fb580d59 (diff)
Merge remote-tracking branch 'glitch/main'
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/preload_link_headers.rb2
-rw-r--r--config/initializers/rack_attack.rb7
2 files changed, 7 insertions, 2 deletions
diff --git a/config/initializers/preload_link_headers.rb b/config/initializers/preload_link_headers.rb
index 9f21c45ec..364a7cc1b 100644
--- a/config/initializers/preload_link_headers.rb
+++ b/config/initializers/preload_link_headers.rb
@@ -2,7 +2,7 @@
 # in the Links header per default.
 
 # In our case, that will bloat headers too much and potentially cause
-# issues with reverse proxies. Furhermore, we don't need those links,
+# issues with reverse proxies. Furthermore, we don't need those links,
 # as we already output them as HTML link tags.
 
 Rails.application.config.action_view.preload_links_header = false
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb
index 964d4266d..c3733e377 100644
--- a/config/initializers/rack_attack.rb
+++ b/config/initializers/rack_attack.rb
@@ -82,7 +82,12 @@ 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'
+      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
 
   throttle('throttle_password_resets/ip', limit: 25, period: 5.minutes) do |req|