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] 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 @@
Settings | Coolify - - -
-
-

Configuration

- - Save - -
-
General configuration for your Coolify instance.
+ + + +
+

Configuration

+ + Save + +
+
General configuration for your Coolify instance.
-
-

Instance Settings

-
-
- - -
+

Instance Settings

+
+
+ + +
-
- - -
-
-
- - - - +
+ +
-
- +
+
+ + + + +
+
+ +
+ +

DNS Validation

+
+ +
+
-

DNS Validation

-
- -
- -
- - {{--
+ {{--
--}} -
-

API

-
- -
- +
+

API

+
+ +
+ -

Advanced

-
- - -
-
Update
-
- @if (!is_null(env('AUTOUPDATE', null))) +
Update
+
+ @if (!is_null(env('AUTOUPDATE', null)))
- +
- @else + @else - @endif -
-
-
- - Check Manually + @endif +
+
+
+ + Check Manually +
+ + @if (is_null(env('AUTOUPDATE', null)) && $is_auto_update_enabled) + + @endif
- @if (is_null(env('AUTOUPDATE', null)) && $is_auto_update_enabled) - - @endif -
- +

Advanced

+
+ + +
+ +
Confirmation Settings
+
+ +
+
+

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.

+
+ +
+
+