From 2cb424ed7b29f11d9ebefcd78dd491c86e639f40 Mon Sep 17 00:00:00 2001
From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com>
Date: Thu, 17 Oct 2024 12:07:35 +0200
Subject: [PATCH 1/6] setting to disable tow step confirmation
---
app/Livewire/Settings/Index.php | 9 +-
...on_settings_to_instance_settings_table.php | 22 +++
.../views/livewire/settings/index.blade.php | 175 +++++++++---------
3 files changed, 114 insertions(+), 92 deletions(-)
create mode 100644 database/migrations/2024_10_16_192133_add_confirmation_settings_to_instance_settings_table.php
diff --git a/app/Livewire/Settings/Index.php b/app/Livewire/Settings/Index.php
index 754f0929b..7d3fe62a7 100644
--- a/app/Livewire/Settings/Index.php
+++ b/app/Livewire/Settings/Index.php
@@ -25,6 +25,10 @@ class Index extends Component
public string $update_check_frequency;
+ public $timezones;
+
+ public bool $disable_two_step_confirmation;
+
protected string $dynamic_config_path = '/data/coolify/proxy/dynamic';
protected Server $server;
@@ -55,8 +59,6 @@ class Index extends Component
'update_check_frequency' => 'Update Check Frequency',
];
- public $timezones;
-
public function mount()
{
if (isInstanceAdmin()) {
@@ -69,6 +71,7 @@ class Index extends Component
$this->auto_update_frequency = $this->settings->auto_update_frequency;
$this->update_check_frequency = $this->settings->update_check_frequency;
$this->timezones = collect(timezone_identifiers_list())->sort()->values()->toArray();
+ $this->disable_two_step_confirmation = $this->settings->disable_two_step_confirmation;
} else {
return redirect()->route('dashboard');
}
@@ -83,6 +86,7 @@ class Index extends Component
$this->settings->is_api_enabled = $this->is_api_enabled;
$this->settings->auto_update_frequency = $this->auto_update_frequency;
$this->settings->update_check_frequency = $this->update_check_frequency;
+ $this->settings->disable_two_step_confirmation = $this->disable_two_step_confirmation;
$this->settings->save();
$this->dispatch('success', 'Settings updated!');
}
@@ -148,6 +152,7 @@ class Index extends Component
$this->settings->is_api_enabled = $this->is_api_enabled;
$this->settings->auto_update_frequency = $this->auto_update_frequency;
$this->settings->update_check_frequency = $this->update_check_frequency;
+ $this->settings->disable_two_step_confirmation = $this->disable_two_step_confirmation;
$this->settings->save();
$this->server->setupDynamicProxyConfiguration();
if (! $error_show) {
diff --git a/database/migrations/2024_10_16_192133_add_confirmation_settings_to_instance_settings_table.php b/database/migrations/2024_10_16_192133_add_confirmation_settings_to_instance_settings_table.php
new file mode 100644
index 000000000..7040daf44
--- /dev/null
+++ b/database/migrations/2024_10_16_192133_add_confirmation_settings_to_instance_settings_table.php
@@ -0,0 +1,22 @@
+boolean('disable_two_step_confirmation')->default(false);
+ });
+ }
+
+ public function down()
+ {
+ Schema::table('instance_settings', function (Blueprint $table) {
+ $table->dropColumn('disable_two_step_confirmation');
+ });
+ }
+};
diff --git a/resources/views/livewire/settings/index.blade.php b/resources/views/livewire/settings/index.blade.php
index f9293e7d7..db2a06995 100644
--- a/resources/views/livewire/settings/index.blade.php
+++ b/resources/views/livewire/settings/index.blade.php
@@ -1,26 +1,24 @@
From e1e00af35a66c6d972bcd950fc94fb35e297f61d Mon Sep 17 00:00:00 2001
From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com>
Date: Thu, 17 Oct 2024 12:28:07 +0200
Subject: [PATCH 4/6] disable tow step confirmation by default on dev
---
database/seeders/DatabaseSeeder.php | 1 +
.../DisableTwoStepConfirmationSeeder.php | 20 +++++++++++++++++++
2 files changed, 21 insertions(+)
create mode 100644 database/seeders/DisableTwoStepConfirmationSeeder.php
diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php
index be5083108..1339e7889 100644
--- a/database/seeders/DatabaseSeeder.php
+++ b/database/seeders/DatabaseSeeder.php
@@ -26,6 +26,7 @@ class DatabaseSeeder extends Seeder
S3StorageSeeder::class,
StandalonePostgresqlSeeder::class,
OauthSettingSeeder::class,
+ DisableTwoStepConfirmationSeeder::class,
]);
}
}
diff --git a/database/seeders/DisableTwoStepConfirmationSeeder.php b/database/seeders/DisableTwoStepConfirmationSeeder.php
new file mode 100644
index 000000000..c43bf1b01
--- /dev/null
+++ b/database/seeders/DisableTwoStepConfirmationSeeder.php
@@ -0,0 +1,20 @@
+updateOrInsert(
+ [],
+ ['disable_two_step_confirmation' => true]
+ );
+ }
+}
From 83c7e1b78b50eacd890bd2282758862b4f3e5cde Mon Sep 17 00:00:00 2001
From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com>
Date: Thu, 17 Oct 2024 12:36:18 +0200
Subject: [PATCH 5/6] fix typos
---
resources/views/livewire/settings/index.blade.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/resources/views/livewire/settings/index.blade.php b/resources/views/livewire/settings/index.blade.php
index b8874cbac..0fb111d91 100644
--- a/resources/views/livewire/settings/index.blade.php
+++ b/resources/views/livewire/settings/index.blade.php
@@ -109,7 +109,7 @@
Warning!
-
Disabling two-step confirmation reduces security (as anyone can easily delete anything) and increases the risk of accidental actions. This is not recommended for production servers.
+
Disabling two step confirmation reduces security (as anyone can easily delete anything) and increases the risk of accidental actions. This is not recommended for production servers.
@if($disable_two_step_confirmation)
@@ -119,10 +119,10 @@
buttonTitle="Disable Two Step Confirmation"
isErrorButton
submitAction="toggleTwoStepConfirmation"
- :actions="['Tow Step confimation will be disabled globally.', 'Disabling two-step confirmation reduces security (as anyone can easily delete anything).', 'The risk of accidental actions will increase.']"
+ :actions="['Tow Step confimation will be disabled globally.', 'Disabling two step confirmation reduces security (as anyone can easily delete anything).', 'The risk of accidental actions will increase.']"
confirmationText="DISABLE TWO STEP CONFIRMATION"
confirmationLabel="Please type the confirmation text to disable two step confirmation."
- shortConfirmationLabel="Type Confirmation Text"
+ shortConfirmationLabel="Confirmation text"
step3ButtonText="Disable Two Step Confirmation"
/>
@endif
From 8b114f555874130ecd0e7b1850e7bce7574ed7d3 Mon Sep 17 00:00:00 2001
From: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com>
Date: Thu, 17 Oct 2024 13:05:58 +0200
Subject: [PATCH 6/6] fix button text kind of
---
resources/views/components/modal-confirmation.blade.php | 2 +-
resources/views/livewire/server/delete.blade.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php
index a0175c1a1..4dc4e83e7 100644
--- a/resources/views/components/modal-confirmation.blade.php
+++ b/resources/views/components/modal-confirmation.blade.php
@@ -331,7 +331,7 @@
}
"
>
-
+
diff --git a/resources/views/livewire/server/delete.blade.php b/resources/views/livewire/server/delete.blade.php
index 360e1e0c6..86053c0d4 100644
--- a/resources/views/livewire/server/delete.blade.php
+++ b/resources/views/livewire/server/delete.blade.php
@@ -16,7 +16,7 @@
+ shortConfirmationLabel="Server Name" step3ButtonText="Permanently Delete" />
@endif
@endif