fix: 🐛 Recaptcha credentials must not be null even if disabled

This commit is contained in:
IceToast 2022-08-06 16:39:31 +02:00
parent ebf8902870
commit 935bc05880
6 changed files with 278 additions and 341 deletions

View file

@ -90,6 +90,11 @@ class AppServiceProvider extends ServiceProvider
// Set Recaptcha API Config // Set Recaptcha API Config
// Load recaptcha package if recaptcha is enabled
if(config('SETTINGS::RECAPTCHA:ENABLED') == 'true') {
$this->app->register(\Biscolab\ReCaptcha\ReCaptchaServiceProvider::class);
}
//only update config if recaptcha settings have changed in DB //only update config if recaptcha settings have changed in DB
if ( if (
config('recaptcha.api_site_key') != config('SETTINGS::RECAPTCHA:SITE_KEY') || config('recaptcha.api_site_key') != config('SETTINGS::RECAPTCHA:SITE_KEY') ||

View file

@ -10,7 +10,7 @@
"require": { "require": {
"php": "^8.0|^7.4", "php": "^8.0|^7.4",
"ext-intl": "*", "ext-intl": "*",
"biscolab/laravel-recaptcha": "^5.0", "biscolab/laravel-recaptcha": "^5.4",
"doctrine/dbal": "^3.1", "doctrine/dbal": "^3.1",
"fideloper/proxy": "^4.4", "fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0", "fruitcake/laravel-cors": "^2.0",
@ -47,7 +47,9 @@
}, },
"extra": { "extra": {
"laravel": { "laravel": {
"dont-discover": [] "dont-discover": [
"biscolab/laravel-recaptcha"
]
} }
}, },
"autoload": { "autoload": {

600
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -180,7 +180,7 @@ return [
Illuminate\Translation\TranslationServiceProvider::class, Illuminate\Translation\TranslationServiceProvider::class,
Illuminate\Validation\ValidationServiceProvider::class, Illuminate\Validation\ValidationServiceProvider::class,
Illuminate\View\ViewServiceProvider::class, Illuminate\View\ViewServiceProvider::class,
Biscolab\ReCaptcha\ReCaptchaServiceProvider::class,
/* /*
* Package Service Providers... * Package Service Providers...
@ -250,7 +250,6 @@ return [
'URL' => Illuminate\Support\Facades\URL::class, 'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class, 'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class, 'View' => Illuminate\Support\Facades\View::class,
'ReCaptcha' => Biscolab\ReCaptcha\Facades\ReCaptcha::class,
'DataTables' => Yajra\DataTables\Facades\DataTables::class, 'DataTables' => Yajra\DataTables\Facades\DataTables::class,
], ],

View file

@ -63,7 +63,7 @@
</span> </span>
@enderror @enderror
</div> </div>
@if (config('SETTINGS::RECAPTCHA:ENABLED') == 'true')
<div class="input-group mb-3"> <div class="input-group mb-3">
{!! htmlFormSnippet() !!} {!! htmlFormSnippet() !!}
@error('g-recaptcha-response') @error('g-recaptcha-response')
@ -72,6 +72,7 @@
</span> </span>
@enderror @enderror
</div> </div>
@endif
<div class="row"> <div class="row">
<div class="col-8"> <div class="col-8">

View file

@ -101,6 +101,7 @@
</div> </div>
</div> </div>
@endif @endif
@if (config('SETTINGS::RECAPTCHA:ENABLED') == 'true')
<div class="input-group mb-3"> <div class="input-group mb-3">
{!! htmlFormSnippet() !!} {!! htmlFormSnippet() !!}
@error('g-recaptcha-response') @error('g-recaptcha-response')
@ -109,6 +110,7 @@
</span> </span>
@enderror @enderror
</div> </div>
@endif
<div class="row"> <div class="row">
<div class="col-8"> <div class="col-8">