feat: ✨ Added ReCaptcha to Settings & Added option to dis/enable
This commit is contained in:
parent
21a86ce44d
commit
a8c19ffe2c
3 changed files with 60 additions and 12 deletions
|
@ -5,7 +5,6 @@ namespace App\Classes\Settings;
|
|||
use App\Models\Settings;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
class System
|
||||
{
|
||||
|
@ -20,17 +19,23 @@ class System
|
|||
|
||||
public function updateSettings(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'icon' => 'nullable|max:10000|mimes:jpg,png,jpeg',
|
||||
'favicon' => 'nullable|max:10000|mimes:ico',
|
||||
]);
|
||||
|
||||
|
||||
$values = [
|
||||
//SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form)
|
||||
"SETTINGS::SYSTEM:REGISTER_IP_CHECK" => "register-ip-check",
|
||||
"SETTINGS::SYSTEM:SERVER_CREATE_CHARGE_FIRST_HOUR" => "server-create-charge-first-hour",
|
||||
"SETTINGS::SYSTEM:CREDITS_DISPLAY_NAME" => "credits-display-name",
|
||||
"SETTINGS::SERVER:ALLOCATION_LIMIT" => "allocation-limit",
|
||||
"SETTINGS::USER:FORCE_DISCORD_VERIFICATION" => "force-discord-verification",
|
||||
"SETTINGS::USER:FORCE_EMAIL_VERIFICATION" => "force-email-verification",
|
||||
"SETTINGS::USER:INITIAL_CREDITS" => "initial-credits",
|
||||
"SETTINGS::USER:INITIAL_SERVER_LIMIT" => "initial-server-limit",
|
||||
"SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_DISCORD" => "credits-reward-amount-discord",
|
||||
"SETTINGS::USER:CREDITS_REWARD_AFTER_VERIFY_EMAIL" => "credits-reward-amount-email",
|
||||
"SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD" => "server-limit-discord",
|
||||
"SETTINGS::USER:SERVER_LIMIT_REWARD_AFTER_VERIFY_EMAIL" => "server-limit-email",
|
||||
"SETTINGS::MISC:PHPMYADMIN:URL" => "phpmyadmin-url",
|
||||
|
||||
|
||||
"SETTINGS::RECAPTCHA:SITE_KEY" => "recaptcha-site-key",
|
||||
"SETTINGS::RECAPTCHA:SECRET_KEY" => "recaptcha-secret-key",
|
||||
"SETTINGS::RECAPTCHA:ENABLED" => "recaptcha-enabled",
|
||||
];
|
||||
|
||||
|
||||
|
|
|
@ -380,7 +380,7 @@ class SettingsSeeder extends Seeder
|
|||
]);
|
||||
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::SYSTEM:RECAPTCHA_SITE_KEY',
|
||||
'key' => 'SETTINGS::RECAPTCHA:SITE_KEY',
|
||||
], [
|
||||
'value' => '6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI',
|
||||
'type' => 'string',
|
||||
|
@ -388,11 +388,17 @@ class SettingsSeeder extends Seeder
|
|||
]);
|
||||
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::SYSTEM:RECAPTCHA_SECRET_KEY',
|
||||
'key' => 'SETTINGS::RECAPTCHA:SECRET_KEY',
|
||||
], [
|
||||
'value' => '6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe',
|
||||
'type' => 'string',
|
||||
'description' => 'Google Recaptcha API Credentials - https://www.google.com/recaptcha/admin - reCaptcha V2 (not v3)'
|
||||
]);
|
||||
Settings::firstOrCreate([
|
||||
'key' => 'SETTINGS::RECAPTCHA:ENABLED',
|
||||
], [
|
||||
'value' => 'true',
|
||||
'type' => 'boolean',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,43 @@
|
|||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-md-3 px-3">
|
||||
<div class="row mb-2">
|
||||
<div class="col text-center">
|
||||
<h1>ReCaptcha</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="custom-control mb-3 p-0">
|
||||
<div class="col m-0 p-0 d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<input value="true" id="enable-recaptcha" name="enable-recaptcha"
|
||||
{{ config('SETTINGS::RECAPTCHA:ENABLED') == 'true' ? 'checked' : '' }}
|
||||
type="checkbox">
|
||||
<label for="enable-recaptcha">{{ __('Enable ReCaptcha') }} </label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<div class="custom-control p-0">
|
||||
<label for="discord-client-id">{{ __('ReCaptcha Site-Key') }}:</label>
|
||||
<input x-model="ReCaptcha-client-id" id="ReCaptcha-client-id" name="ReCaptcha-client-id"
|
||||
type="text" value="{{ config('SETTINGS::RECAPTCHA:SITE_KEY') }}"
|
||||
class="form-control @error('ReCaptcha-client-id') is-invalid @enderror">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mb-3">
|
||||
<div class="custom-control p-0">
|
||||
<label for="ReCaptcha-client-secret">{{ __('ReCaptcha Secret-Key') }}:</label>
|
||||
<input x-model="ReCaptcha-client-secret" id="recaptcha-client-secret"
|
||||
name="ReCaptcha-client-secret" type="text"
|
||||
value="{{ config('SETTINGS::RECAPTCHA:SECRET_KEY') }}"
|
||||
class="form-control @error('ReCaptcha-client-secret') is-invalid @enderror">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<button class="btn btn-primary mt-3 ml-3">{{ __('Submit') }}</button>
|
||||
|
|
Loading…
Reference in a new issue