diff --git a/resources/views/livewire/settings/email.blade.php b/resources/views/livewire/settings/email.blade.php
index d863572..8d78dfe 100644
--- a/resources/views/livewire/settings/email.blade.php
+++ b/resources/views/livewire/settings/email.blade.php
@@ -60,16 +60,25 @@
-
-
-
- {{ __('mail.test_send') }}
-
-
-
- {{ __('common.save') }}
-
+
+
+ @if ($this->configured())
+
+ {{ __('mail.reset') }}
+
+ @endif
+
+
+
+
+ {{ __('mail.test_send') }}
+
+
+
+ {{ __('common.save') }}
+
+
diff --git a/resources/views/livewire/terminal/index.blade.php b/resources/views/livewire/terminal/index.blade.php
index 028da8a..c8b9a3f 100644
--- a/resources/views/livewire/terminal/index.blade.php
+++ b/resources/views/livewire/terminal/index.blade.php
@@ -36,7 +36,7 @@
-
+
diff --git a/tests/Feature/SmtpConfigTest.php b/tests/Feature/SmtpConfigTest.php
index b5abb6a..c8c7041 100644
--- a/tests/Feature/SmtpConfigTest.php
+++ b/tests/Feature/SmtpConfigTest.php
@@ -56,6 +56,31 @@ class SmtpConfigTest extends TestCase
$this->assertDatabaseHas('audit_events', ['action' => 'mail.configure', 'target' => 'smtp.example.com']);
}
+ public function test_clear_config_removes_all_mail_settings(): void
+ {
+ $this->actingUser();
+ Setting::put('mail_host', 'smtp.example.com');
+ Setting::put('mail_port', '2525');
+ Setting::put('mail_username', 'panel');
+ Setting::put('mail_password', Crypt::encryptString('s3cr3t-pw'));
+ Setting::put('mail_encryption', 'ssl');
+ Setting::put('mail_from_address', 'panel@example.com');
+ Setting::put('mail_from_name', 'Clusev');
+
+ Livewire::test(Email::class)
+ ->assertSet('mail_host', 'smtp.example.com') // mounted from the stored value
+ ->call('clearConfig')
+ ->assertHasNoErrors()
+ ->assertSet('mail_host', '')
+ ->assertSet('mail_from_address', '')
+ ->assertSet('passwordSet', false);
+
+ foreach (['mail_host', 'mail_port', 'mail_username', 'mail_password', 'mail_encryption', 'mail_from_address', 'mail_from_name'] as $key) {
+ $this->assertNull(Setting::get($key), "$key must be cleared");
+ }
+ $this->assertDatabaseHas('audit_events', ['action' => 'mail.reset']);
+ }
+
public function test_password_is_not_overwritten_when_left_blank(): void
{
$this->actingUser();