fix(project): cast smtpPort to int in response model

This commit is contained in:
Prem Palanisamy
2026-05-22 07:26:01 +01:00
parent 9951ccdca3
commit e364082577
2 changed files with 3 additions and 3 deletions
@@ -94,7 +94,7 @@ class Project extends Model
->addRule('smtpPort', [
'type' => self::TYPE_INTEGER,
'description' => 'SMTP server port',
'default' => '',
'default' => 0,
'example' => 25,
])
->addRule('smtpUsername', [
@@ -225,7 +225,7 @@ class Project extends Model
$document->setAttribute('smtpReplyToEmail', $smtp['replyToEmail'] ?? $smtp['replyTo'] ?? ''); // Includes backwards compatibility
$document->setAttribute('smtpReplyToName', $smtp['replyToName'] ?? '');
$document->setAttribute('smtpHost', $smtp['host'] ?? '');
$document->setAttribute('smtpPort', $smtp['port'] ?? '');
$document->setAttribute('smtpPort', (int) ($smtp['port'] ?? 0));
$document->setAttribute('smtpUsername', $smtp['username'] ?? '');
$document->setAttribute('smtpPassword', ''); // Write-only: never expose the stored value
$document->setAttribute('smtpSecure', $smtp['secure'] ?? '');
@@ -103,7 +103,7 @@ class ProjectConsoleClientTest extends Scope
$this->assertSame('', $response['body']['smtpReplyToEmail']);
$this->assertSame('', $response['body']['smtpReplyToName']);
$this->assertSame('', $response['body']['smtpHost']);
$this->assertSame('', $response['body']['smtpPort']);
$this->assertSame(0, $response['body']['smtpPort']);
$this->assertSame('', $response['body']['smtpUsername']);
$this->assertSame('', $response['body']['smtpPassword']);
$this->assertSame('', $response['body']['smtpSecure']);