Update login/register views and captcha config, enable login or register captchas or both

This commit is contained in:
Daniel Supernault 2023-05-23 03:52:34 -06:00
parent 39a42c637f
commit c071c7195e
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
5 changed files with 10 additions and 5 deletions

View file

@ -70,7 +70,7 @@ class LoginController extends Controller
'password' => 'required|string|min:6', 'password' => 'required|string|min:6',
]; ];
if(config('captcha.enabled')) { if(config('captcha.enabled') || config('captcha.active.login')) {
$rules['h-captcha-response'] = 'required|captcha'; $rules['h-captcha-response'] = 'required|captcha';
} }

View file

@ -137,7 +137,7 @@ class RegisterController extends Controller
'password' => 'required|string|min:'.config('pixelfed.min_password_length').'|confirmed', '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'; $rules['h-captcha-response'] = 'required|captcha';
} }

View file

@ -12,4 +12,9 @@ return [
'attributes' => [ 'attributes' => [
'theme' => 'light' 'theme' => 'light'
], ],
'active' => [
'login' => env('CAPTCHA_ENABLED_ON_LOGIN', false),
'register' => env('CAPTCHA_ENABLED_ON_REGISTER', false)
]
]; ];

View file

@ -50,7 +50,7 @@
</div> </div>
</div> </div>
@if(config('captcha.enabled')) @if(config('captcha.enabled') || config('captcha.active.login'))
<div class="d-flex justify-content-center mb-3"> <div class="d-flex justify-content-center mb-3">
{!! Captcha::display() !!} {!! Captcha::display() !!}
</div> </div>

View file

@ -81,7 +81,7 @@
</div> </div>
</div> </div>
@if(config('captcha.enabled')) @if(config('captcha.enabled') || config('captcha.active.register'))
<div class="d-flex justify-content-center my-3"> <div class="d-flex justify-content-center my-3">
{!! Captcha::display() !!} {!! Captcha::display() !!}
</div> </div>