Add exception list for captcha

This commit is contained in:
Mark Smith 2023-04-05 22:51:43 -07:00
parent 36f5fa7c53
commit 1d935915d2
2 changed files with 12 additions and 1 deletions

View File

@ -272,12 +272,17 @@ sub should_captcha_view {
return 0 if $r->uri =~ $LJ::CAPTCHA_BYPASS_REGEX;
}
# If the user is on a trusted IP range, no captcha
# If the user is on an automated IP range, captcha
my ( $mckey, $ip ) = _captcha_mckey();
if ( my $matcher = $LJ::SHOULD_CAPTCHA_IP ) {
return 0 unless $matcher->($ip);
}
# Unless the user is the Google bot... then allow it
if ( my $matcher = $LJ::CAPTCHA_BYPASS_IP ) {
return 0 if $matcher->($ip);
}
# Get our captcha information -- no information means that the user has not
# passed a captcha. If we have information, then they *have* at some point.
my $info_raw = LJ::MemCache::get($mckey);

View File

@ -241,6 +241,12 @@ use Net::Subnet;
# $SHOULD_CAPTCHA_IP = subnet_matcher qw(
# 10.0.0.0/8
# );
#
# # Put subnets in here that may be automated but you want to allow them
# # anyway for some reason.
# $CAPTCHA_BYPASS_IP = subnet_matcher qw(
# 192.168.10.10/32
# );
}
{