Skip to content
This repository was archived by the owner on Jun 10, 2024. It is now read-only.

Commit ee45411

Browse files
author
Viktor Mazur
committed
Feature skip IP/CIDR netmask
1 parent b3ef5c2 commit ee45411

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

config/recaptcha.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@
5151
/**
5252
*
5353
* IP addresses for which validation will be skipped
54+
* IP/CIDR netmask eg. 127.0.0.0/24, also 127.0.0.1 is accepted and /32 assumed
5455
*
5556
*/
56-
'skip_ip' => [],
57+
'skip_ip' => env('RECAPTCHA_SKIP_IP', []),
5758

5859
/**
5960
*

src/ReCaptchaBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Biscolab\ReCaptcha;
1313

1414
use Illuminate\Support\Arr;
15+
use Symfony\Component\HttpFoundation\IpUtils;
1516

1617
/**
1718
* Class ReCaptchaBuilder
@@ -247,8 +248,7 @@ public function getIpWhitelist()
247248
*/
248249
public function skipByIp(): bool
249250
{
250-
251-
return (in_array(request()->ip(), $this->getIpWhitelist()));
251+
return IpUtils::checkIp(request()->ip(), $this->getIpWhitelist());
252252
}
253253

254254
/**

0 commit comments

Comments
 (0)