From c071c7195ed302b63afa3a010b9bff36581d0d84 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 23 May 2023 03:52:34 -0600 Subject: [PATCH] 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() !!}