This commit is contained in:
Andras Bacsai
2023-06-20 21:18:14 +02:00
parent d4976c6eb6
commit 4a1378debd
4 changed files with 49 additions and 2 deletions

View File

@@ -39,6 +39,19 @@ class EmailSettings extends Component
'model.smtp.password' => 'Password',
'model.smtp.test_recipients' => 'Test Recipients',
];
private function decrypt()
{
if (data_get($this->model, 'smtp.password')) {
try {
$this->model->smtp->password = decrypt($this->model->smtp->password);
} catch (\Exception $e) {
}
}
}
public function mount()
{
$this->decrypt();
}
public function copyFromInstanceSettings()
{
$settings = InstanceSettings::get();
@@ -63,6 +76,13 @@ class EmailSettings extends Component
{
$this->resetErrorBag();
$this->validate();
if ($this->model->smtp->password) {
$this->model->smtp->password = encrypt($this->model->smtp->password);
} else {
$this->model->smtp->password = null;
}
$this->model->smtp->recipients = str_replace(' ', '', $this->model->smtp->recipients);
$this->model->smtp->test_recipients = str_replace(' ', '', $this->model->smtp->test_recipients);
$this->saveModel();