Skip to content

Commit

Permalink
improve MailSettings filterFields
Browse files Browse the repository at this point in the history
  • Loading branch information
mjauvin committed Mar 21, 2024
1 parent 917675a commit 932ca84
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions modules/system/models/MailSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function getSmtpEncryptionOptions()
*/
public function filterFields($fields, $context = null)
{
if (in_array($fields->smtp_port->value ?? 25, [25, 465, 587])) {
if ($fields->smtp_port && $fields->smtp_encryption) {
switch ($fields->smtp_encryption->value ?? '') {
case 'tls':
$fields->smtp_port->value = 587;
Expand All @@ -151,13 +151,8 @@ public function filterFields($fields, $context = null)
break;
case '':
default:
$fields->smtp_port->value = 25;
break;
$fields->smtp_port->value = 587;
}
}
if (!$fields->smtp_authorization->value) {
$fields->smtp_user->hidden = true;
$fields->smtp_password->hidden = true;
}
}
}

0 comments on commit 932ca84

Please sign in to comment.