Skip to content

Commit 7c4c673

Browse files
feat: Migrate from Google reCAPTCHA to Cloudflare Turnstile
1 parent cd7b72e commit 7c4c673

39 files changed

+3251
-3420
lines changed

.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ LOG_LEVEL=info
5858

5959
EVENTBRITE_OAUTH2_PERSONAL_TOKEN=
6060

61-
RECAPTCHA_PUBLIC_KEY=
62-
RECAPTCHA_PRIVATE_KEY=
61+
TURNSTILE_SITE_KEY=
62+
TURNSTILE_SECRET_KEY=
6363

6464
BANNING_ENABLE=
6565
SUPPORT_EMAIL=

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
18.20.2
1+
20.20.2

app/Http/Controllers/Auth/EmailVerificationController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ protected function validator(array $data)
8787
{
8888
return Validator::make($data, [
8989
'email' => 'required|string|email|max:255',
90-
'g-recaptcha-response' => 'required|recaptcha',
90+
'cf-turnstile-response' => 'required|turnstile',
9191
]);
9292
}
9393

app/Http/Controllers/Auth/ForgotPasswordController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ protected function validator(array $data)
162162
{
163163
return Validator::make($data, [
164164
'email' => 'required|string|email|max:255',
165+
'cf-turnstile-response' => 'required|turnstile',
165166
]);
166167
}
167168

app/Http/Controllers/Auth/PasswordSetController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ protected function validator(array $data)
155155
'company' => 'sometimes|string|max:100',
156156
'country_iso_code' => 'required|string|country_iso_alpha2_code',
157157
'password' => 'required|string|confirmed|password_policy',
158-
'g-recaptcha-response' => 'required|recaptcha',
158+
'cf-turnstile-response' => 'required|turnstile',
159159
]);
160160
}
161161

app/Http/Controllers/Auth/RegisterController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ protected function validator(array $data)
177177
'country_iso_code' => 'required|string|country_iso_alpha2_code',
178178
'email' => 'required|string|email|max:255',
179179
'password' => 'required|string|confirmed|password_policy',
180-
'g-recaptcha-response' => 'required|recaptcha',
180+
'cf-turnstile-response' => 'required|turnstile',
181181
];
182182

183183
if(!empty(Config::get("app.code_of_conduct_link", null))){

app/Http/Controllers/Auth/ResetPasswordController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected function validator(array $data)
113113
return Validator::make($data, [
114114
'token' => 'required',
115115
'password' => 'required|string|confirmed|password_policy',
116-
'g-recaptcha-response' => 'required|recaptcha',
116+
'cf-turnstile-response' => 'required|turnstile',
117117
]);
118118
}
119119

app/Http/Controllers/UserController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ public function postLogin()
420420
];
421421

422422
if ($login_attempts >= $max_login_attempts_2_show_captcha) {
423-
$rules['g-recaptcha-response'] = 'required|recaptcha';
423+
$rules['cf-turnstile-response'] = 'required|turnstile';
424424
}
425425
// Create a new validator instance.
426426
$validator = Validator::make($data, $rules);

composer.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@
1111
],
1212
"license": "MIT",
1313
"type": "project",
14-
"repositories": [
15-
{
16-
"type": "vcs",
17-
"url": "https://github.com/smarcet/recaptcha"
18-
}
19-
],
2014
"require": {
2115
"php": "^8.3",
2216
"ext-json": "*",
@@ -29,7 +23,6 @@
2923
"firebase/php-jwt": "6.11.1",
3024
"get-stream/stream-chat": "^3.10.0",
3125
"glenscott/url-normalizer": "1.4.0",
32-
"greggilbert/recaptcha": "dev-master",
3326
"guzzlehttp/guzzle": "7.9.3",
3427
"guzzlehttp/uri-template": "^1.0",
3528
"ircmaxell/random-lib": "1.2.0",
@@ -49,6 +42,7 @@
4942
"php-opencloud/openstack": "3.10.0",
5043
"phpseclib/phpseclib": "^3.0.43",
5144
"predis/predis": "v2.2.2",
45+
"ryangjchandler/laravel-cloudflare-turnstile": "^3.0",
5246
"s-ichikawa/laravel-sendgrid-driver": "^4.0",
5347
"smarcet/jose4php": "2.0.0",
5448
"socialiteproviders/apple": "^5.6.1",

composer.lock

Lines changed: 76 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)