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

Commit 1352776

Browse files
committed
Merge branch 'master' into release/v5
2 parents 42298ef + 519419f commit 1352776

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
on: [push, pull_request]
3+
4+
jobs:
5+
run:
6+
runs-on: ${{ matrix.os }}
7+
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest]
11+
php: ['7.3', '7.4', '8.0']
12+
13+
name: PHP ${{ matrix.php }} Test on ${{ matrix.os }}
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: ${{matrix.php}}
23+
24+
- name: Install dependencies
25+
uses: php-actions/composer@v5
26+
with:
27+
args: --prefer-source --no-interaction
28+
29+
- name: Run composer test script
30+
uses: php-actions/composer@v5
31+
with:
32+
command: test

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)