From c071c7195ed302b63afa3a010b9bff36581d0d84 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 23 May 2023 03:52:34 -0600 Subject: [PATCH 1/2] Update login/register views and captcha config, enable login or register captchas or both --- app/Http/Controllers/Auth/LoginController.php | 2 +- app/Http/Controllers/Auth/RegisterController.php | 2 +- config/captcha.php | 7 ++++++- resources/views/auth/login.blade.php | 2 +- resources/views/auth/register.blade.php | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 6bcec3647..5a11808ce 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -70,7 +70,7 @@ class LoginController extends Controller 'password' => 'required|string|min:6', ]; - if(config('captcha.enabled')) { + if(config('captcha.enabled') || config('captcha.active.login')) { $rules['h-captcha-response'] = 'required|captcha'; } diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 0e62abef8..b70f1d52a 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -137,7 +137,7 @@ class RegisterController extends Controller 'password' => 'required|string|min:'.config('pixelfed.min_password_length').'|confirmed', ]; - if(config('captcha.enabled')) { + if(config('captcha.enabled') || config('captcha.active.register')) { $rules['h-captcha-response'] = 'required|captcha'; } diff --git a/config/captcha.php b/config/captcha.php index baeeae2d2..4f55cbb1d 100644 --- a/config/captcha.php +++ b/config/captcha.php @@ -12,4 +12,9 @@ return [ 'attributes' => [ 'theme' => 'light' ], -]; \ No newline at end of file + + 'active' => [ + 'login' => env('CAPTCHA_ENABLED_ON_LOGIN', false), + 'register' => env('CAPTCHA_ENABLED_ON_REGISTER', false) + ] +]; diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index 19b241485..73559826e 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -50,7 +50,7 @@ - @if(config('captcha.enabled')) + @if(config('captcha.enabled') || config('captcha.active.login'))
{!! Captcha::display() !!}
diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 5f3b6e503..a2c008bd7 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -81,7 +81,7 @@ - @if(config('captcha.enabled')) + @if(config('captcha.enabled') || config('captcha.active.register'))
{!! Captcha::display() !!}
From f9eb99c8979e1eeed4b91491c1f35c38f189636d Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 23 May 2023 03:54:07 -0600 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 999b9f305..452187e1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ - Update MediaController, add fallback for local files that are later stored on S3 but still are referenced in cached objects remotely ([4973cb46](https://github.com/pixelfed/pixelfed/commit/4973cb46)) - Update PublicTimelineService, improve warmCache query ([9f901d65](https://github.com/pixelfed/pixelfed/commit/9f901d65)) - Update AP Inbox, fix delete handling ([2800c888](https://github.com/pixelfed/pixelfed/commit/2800c888)) +- Update login/register views and captcha config, enable login or register captchas or both ([c071c719](https://github.com/pixelfed/pixelfed/commit/c071c719)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.6 (2023-05-03)](https://github.com/pixelfed/pixelfed/compare/v0.11.5...v0.11.6)