Skip to content

Commit

Permalink
correct variable
Browse files Browse the repository at this point in the history
  • Loading branch information
stkenny committed Feb 15, 2025
1 parent 1bb2ffe commit 485c42a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/controllers/bot_detect_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ class BotDetectController < ApplicationController
# subnet: /24 for IPv4, and /72 for IPv6
# https://git.drupalcode.org/project/turnstile_protect/-/blob/0dae9f95d48f9d8cae5a8e61e767c69f64490983/src/EventSubscriber/Challenge.php#L140-151
class_attribute :rate_limit_discriminator, default: (lambda do |req|
ip = Rails.env.production? ? req.remote_ip : ip
if req.ip.index(":") # ipv6
IPAddr.new("#{req.ip}/24").to_string
ip = Rails.env.production? ? req.remote_ip : req.ip
if ip.index(":") # ipv6
IPAddr.new("#{ip}/24").to_string
else
IPAddr.new("#{req.ip}/72").to_string
IPAddr.new("#{ip}/72").to_string
end
rescue IPAddr::InvalidAddressError
req.ip
Expand Down

0 comments on commit 485c42a

Please sign in to comment.