Add encrypted migrations and closes #897
This commit is contained in:
parent
ee5b99ce71
commit
754d4f178f
7 changed files with 42 additions and 31 deletions
|
@ -6,7 +6,7 @@ class CreateMollieSettings extends SettingsMigration
|
|||
{
|
||||
public function up(): void
|
||||
{
|
||||
$this->migrator->add('mollie.api_key', null);
|
||||
$this->migrator->addEncrypted('mollie.api_key', null);
|
||||
$this->migrator->add('mollie.enabled', false);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,10 +11,10 @@ class CreatePayPalSettings extends SettingsMigration
|
|||
$table_exists = DB::table('settings_old')->exists();
|
||||
|
||||
|
||||
$this->migrator->add('paypal.client_id', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID') : null);
|
||||
$this->migrator->add('paypal.client_secret', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:PAYPAL:SECRET') : null);
|
||||
$this->migrator->add('paypal.sandbox_client_id', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:PAYPAL:SANDBOX_CLIENT_ID') : null);
|
||||
$this->migrator->add('paypal.sandbox_client_secret', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:PAYPAL:SANDBOX_SECRET') : null);
|
||||
$this->migrator->addEncrypted('paypal.client_id', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:PAYPAL:CLIENT_ID') : null);
|
||||
$this->migrator->addEncrypted('paypal.client_secret', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:PAYPAL:SECRET') : null);
|
||||
$this->migrator->addEncrypted('paypal.sandbox_client_id', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:PAYPAL:SANDBOX_CLIENT_ID') : null);
|
||||
$this->migrator->addEncrypted('paypal.sandbox_client_secret', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:PAYPAL:SANDBOX_SECRET') : null);
|
||||
$this->migrator->add('paypal.enabled', false);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ class CreateStripeSettings extends SettingsMigration
|
|||
{
|
||||
$table_exists = DB::table('settings_old')->exists();
|
||||
|
||||
$this->migrator->add('stripe.secret_key', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:STRIPE:SECRET') : null);
|
||||
$this->migrator->addEncrypted('stripe.secret_key', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:STRIPE:SECRET') : null);
|
||||
$this->migrator->add('stripe.endpoint_secret', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:STRIPE:ENDPOINT_SECRET') : null);
|
||||
$this->migrator->add('stripe.test_secret_key', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:STRIPE:TEST_SECRET') : null);
|
||||
$this->migrator->addEncrypted('stripe.test_secret_key', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:STRIPE:TEST_SECRET') : null);
|
||||
$this->migrator->add('stripe.test_endpoint_secret', $table_exists ? $this->getOldValue('SETTINGS::PAYMENTS:STRIPE:ENDPOINT_TEST_SECRET') : null);
|
||||
$this->migrator->add('stripe.enabled', false);
|
||||
}
|
||||
|
|
|
@ -80,12 +80,17 @@ class MailSettings extends Settings
|
|||
],
|
||||
'mail_password' => [
|
||||
'label' => 'Mail Password',
|
||||
'type' => 'string',
|
||||
'type' => 'password',
|
||||
'description' => 'The password of your mail server.',
|
||||
],
|
||||
'mail_encryption' => [
|
||||
'label' => 'Mail Encryption',
|
||||
'type' => 'string',
|
||||
'type' => 'select',
|
||||
'options' => [
|
||||
'null' => 'None',
|
||||
'tls' => 'TLS',
|
||||
'ssl' => 'SSL'
|
||||
],
|
||||
'description' => 'The encryption of your mail server.',
|
||||
],
|
||||
'mail_from_address' => [
|
||||
|
|
|
@ -10,8 +10,8 @@ class CreatePterodactylSettings extends SettingsMigration
|
|||
$table_exists = DB::table('settings_old')->exists();
|
||||
|
||||
// Get the user-set configuration values from the old table.
|
||||
$this->migrator->add('pterodactyl.admin_token', $table_exists ? $this->getOldValue('SETTINGS::SYSTEM:PTERODACTYL:TOKEN') : env('PTERODACTYL_TOKEN', ''));
|
||||
$this->migrator->add('pterodactyl.user_token', $table_exists ? $this->getOldValue('SETTINGS::SYSTEM:PTERODACTYL:ADMIN_USER_TOKEN') : '');
|
||||
$this->migrator->addEncrypted('pterodactyl.admin_token', $table_exists ? $this->getOldValue('SETTINGS::SYSTEM:PTERODACTYL:TOKEN') : env('PTERODACTYL_TOKEN', ''));
|
||||
$this->migrator->addEncrypted('pterodactyl.user_token', $table_exists ? $this->getOldValue('SETTINGS::SYSTEM:PTERODACTYL:ADMIN_USER_TOKEN') : '');
|
||||
$this->migrator->add('pterodactyl.panel_url', $table_exists ? $this->getOldValue('SETTINGS::SYSTEM:PTERODACTYL:URL') : env('PTERODACTYL_URL', ''));
|
||||
$this->migrator->add('pterodactyl.per_page_limit', $table_exists ? $this->getOldValue('SETTINGS::SYSTEM:PTERODACTYL:PER_PAGE_LIMIT') : 200);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ class CreateMailSettings extends SettingsMigration
|
|||
$this->migrator->add('mail.mail_host', $table_exists ? $this->getOldValue('SETTINGS::MAIL:HOST') : env('MAIL_HOST', 'localhost'));
|
||||
$this->migrator->add('mail.mail_port', $table_exists ? $this->getOldValue('SETTINGS::MAIL:PORT') : env('MAIL_PORT', 25));
|
||||
$this->migrator->add('mail.mail_username', $table_exists ? $this->getOldValue('SETTINGS::MAIL:USERNAME') : env('MAIL_USERNAME', ''));
|
||||
$this->migrator->add('mail.mail_password', $table_exists ? $this->getOldValue('SETTINGS::MAIL:PASSWORD') : env('MAIL_PASSWORD', ''));
|
||||
$this->migrator->addEncrypted('mail.mail_password', $table_exists ? $this->getOldValue('SETTINGS::MAIL:PASSWORD') : env('MAIL_PASSWORD', ''));
|
||||
$this->migrator->add('mail.mail_encryption', $table_exists ? $this->getOldValue('SETTINGS::MAIL:ENCRYPTION') : env('MAIL_ENCRYPTION', 'tls'));
|
||||
$this->migrator->add('mail.mail_from_address', $table_exists ? $this->getOldValue('SETTINGS::MAIL:FROM_ADDRESS') : env('MAIL_FROM_ADDRESS', 'example@example.com'));
|
||||
$this->migrator->add('mail.mail_from_name', $table_exists ? $this->getOldValue('SETTINGS::MAIL:FROM_NAME') : env('APP_NAME', 'CtrlPanel.gg'));
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<!-- CONTENT HEADER -->
|
||||
<section class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="mb-2 row">
|
||||
<div class="col-sm-6">
|
||||
<h1>{{ __('Settings') }}</h1>
|
||||
</div>
|
||||
|
@ -37,13 +37,13 @@
|
|||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="d-flex justify-content-between">
|
||||
<h5 class="card-title"><i class="fas fa-tools mr-2"></i>{{ __('Settings') }}</h5>
|
||||
<h5 class="card-title"><i class="mr-2 fas fa-tools"></i>{{ __('Settings') }}</h5>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<!-- Sidebar Menu -->
|
||||
<div class="d-flex w-100">
|
||||
<div class="col-2 p-0">
|
||||
<div class="p-0 col-2">
|
||||
<nav class="mt-1">
|
||||
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="tablist"
|
||||
data-accordion="false">
|
||||
|
@ -109,17 +109,17 @@
|
|||
</div>
|
||||
<!-- /.sidebar-menu -->
|
||||
<!-- Content in $settings -->
|
||||
<div class="col-10 p-0">
|
||||
<div class="tab-content ml-3" style="width: 100%;">
|
||||
<div container class="tab-pane fade container" id="icons" role="tabpanel">
|
||||
<div class="p-0 col-10">
|
||||
<div class="ml-3 tab-content" style="width: 100%;">
|
||||
<div container class="container tab-pane fade" id="icons" role="tabpanel">
|
||||
|
||||
<form method="POST" enctype="multipart/form-data" class="mb-3"
|
||||
action="{{ route('admin.settings.updateIcons') }}">
|
||||
@csrf
|
||||
@method('POST')
|
||||
<div class="row">
|
||||
<div class="card ml-5" style="width: 18rem;">
|
||||
<span class="h3 text-center">{{ __('FavIcon') }} </span>
|
||||
<div class="ml-5 card" style="width: 18rem;">
|
||||
<span class="text-center h3">{{ __('FavIcon') }} </span>
|
||||
<img src="{{ Storage::disk('public')->exists('favicon.ico') ? asset('storage/favicon.ico') : asset('images/controlpanel_logo.png') }}"
|
||||
style="width:5vw;display: block; margin-left: auto;margin-right: auto"
|
||||
class="card-img-top" alt="...">
|
||||
|
@ -130,8 +130,8 @@
|
|||
name="favicon" id="favicon">
|
||||
</div>
|
||||
|
||||
<div class="card ml-5" style="width: 18rem;">
|
||||
<span class="h3 text-center">{{ __('Icon') }} </span>
|
||||
<div class="ml-5 card" style="width: 18rem;">
|
||||
<span class="text-center h3">{{ __('Icon') }} </span>
|
||||
<img src="{{ Storage::disk('public')->exists('icon.png') ? asset('storage/icon.png') : asset('images/controlpanel_logo.png') }}"
|
||||
style="width:5vw;display: block; margin-left: auto;margin-right: auto"
|
||||
class="card-img-top" alt="...">
|
||||
|
@ -142,8 +142,8 @@
|
|||
class="form-control" name="icon" id="icon">
|
||||
</div>
|
||||
|
||||
<div class="card ml-5" style="width: 18rem;">
|
||||
<span class="h3 text-center">{{ __('Login-page Logo') }} </span>
|
||||
<div class="ml-5 card" style="width: 18rem;">
|
||||
<span class="text-center h3">{{ __('Login-page Logo') }} </span>
|
||||
<img src="{{ Storage::disk('public')->exists('logo.png') ? asset('storage/logo.png') : asset('images/controlpanel_logo.png') }}"
|
||||
style="width:5vw;display: block; margin-left: auto;margin-right: auto"
|
||||
class="card-img-top" alt="...">
|
||||
|
@ -155,7 +155,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<button class="btn btn-primary ml-3 mt-3">{{ __('Save') }}</button>
|
||||
<button class="mt-3 ml-3 btn btn-primary">{{ __('Save') }}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -182,14 +182,14 @@
|
|||
</div>
|
||||
|
||||
<div class="col-8">
|
||||
<div class="custom-control mb-3 d-flex align-items-center">
|
||||
<div class="mb-3 custom-control d-flex align-items-center">
|
||||
@if ($value['description'])
|
||||
<i class="fas fa-info-circle mr-4" data-toggle="popover"
|
||||
<i class="mr-4 fas fa-info-circle" data-toggle="popover"
|
||||
data-trigger="hover" data-placement="top"
|
||||
data-html="true"
|
||||
data-content="{{ $value['description'] }}"></i>
|
||||
@else
|
||||
<i class="fas fa-info-circle mr-4 invisible"></i>
|
||||
<i class="invisible mr-4 fas fa-info-circle"></i>
|
||||
@endif
|
||||
|
||||
<div class="w-100">
|
||||
|
@ -200,6 +200,12 @@
|
|||
value="{{ $value['value'] }}">
|
||||
@break
|
||||
|
||||
@case($value['type'] == 'password')
|
||||
<input type="password" class="form-control"
|
||||
name="{{ $key }}"
|
||||
value="{{ $value['value'] }}">
|
||||
@break
|
||||
|
||||
@case($value['type'] == 'boolean')
|
||||
<input type="checkbox" name="{{ $key }}"
|
||||
value="{{ $value['value'] }}"
|
||||
|
@ -277,7 +283,7 @@
|
|||
<div class="col-8">
|
||||
|
||||
<div class="w-100">
|
||||
<div class="input-group mb-3">
|
||||
<div class="mb-3 input-group">
|
||||
{!! htmlScriptTagJsApi() !!}
|
||||
{!! htmlFormSnippet() !!}
|
||||
@error('g-recaptcha-response')
|
||||
|
@ -294,10 +300,10 @@
|
|||
|
||||
<div class="row">
|
||||
<div class="col-12 d-flex align-items-center justify-content-end">
|
||||
<button type="submit" class="btn btn-primary float-right ">Save
|
||||
<button type="submit" class="float-right btn btn-primary ">Save
|
||||
</button>
|
||||
<button type="reset"
|
||||
class="btn btn-secondary float-right ml-2">Reset
|
||||
class="float-right ml-2 btn btn-secondary">Reset
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue