diff --git a/app/Livewire/Settings/Index.php b/app/Livewire/Settings/Index.php index f60c454f0..1c1a2c391 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; @@ -70,6 +74,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'); } @@ -84,6 +89,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!'); } @@ -175,4 +181,12 @@ class Index extends Component { return view('livewire.settings.index'); } + + public function toggleTwoStepConfirmation() + { + $this->settings->disable_two_step_confirmation = true; + $this->settings->save(); + $this->disable_two_step_confirmation = true; + $this->dispatch('success', 'Two step confirmation has been disabled.'); + } } 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/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index cec05c8fe..6e66c64f4 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, SentinelSeeder::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] + ); + } +} diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php index ef6c477f2..4dc4e83e7 100644 --- a/resources/views/components/modal-confirmation.blade.php +++ b/resources/views/components/modal-confirmation.blade.php @@ -22,18 +22,23 @@ 'dispatchEventMessage' => '', ]) +@php + $settings = instanceSettings(); + $disableTwoStepConfirmation = $settings->disable_two_step_confirmation ?? false; +@endphp +
-

Confirm Actions

-

{{ $confirmationLabel }}

-
- - -
+ @if (!$disableTwoStepConfirmation) + @if ($confirmWithText) +
+

Confirm Actions

+

{{ $confirmationLabel }}

+
+ + +
- - -
+ + +
+ @endif @endif -
- + @endif
@@ -304,41 +314,47 @@ - + submitForm().then((result) => { + if (result === true) { + modalOpen = false; + resetModal(); + } else { + passwordError = result; + } + }); + "> + + + + @endif
diff --git a/resources/views/livewire/server/delete.blade.php b/resources/views/livewire/server/delete.blade.php index 917000273..978943158 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 diff --git a/resources/views/livewire/settings/index.blade.php b/resources/views/livewire/settings/index.blade.php index 7128a2477..bf776d90a 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

@@ -99,26 +80,59 @@
@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.

+
+ @if($disable_two_step_confirmation) + + @else + + @endif +
+
+