feat(ui): SMTP config form TlsMode field
Add a TlsMode read-only row and a None/StartTLS/SSL select to the SMTP Configuration page edit form. New configs default to None; edits load and persist the chosen mode through the repository.
This commit is contained in:
@@ -50,6 +50,8 @@
|
||||
<div class="col-md-8">@smtp.Host:@smtp.Port</div>
|
||||
<div class="col-md-4 text-muted">Auth Type</div>
|
||||
<div class="col-md-8"><span class="badge bg-secondary">@smtp.AuthType</span></div>
|
||||
<div class="col-md-4 text-muted">TLS Mode</div>
|
||||
<div class="col-md-8">@(string.IsNullOrWhiteSpace(smtp.TlsMode) ? "(not set)" : smtp.TlsMode)</div>
|
||||
<div class="col-md-4 text-muted">From Address</div>
|
||||
<div class="col-md-8">@smtp.FromAddress</div>
|
||||
<div class="col-md-4 text-muted">Credentials</div>
|
||||
@@ -73,13 +75,21 @@
|
||||
<label class="form-label">Port</label>
|
||||
<input type="number" class="form-control" @bind="_port" min="1" max="65535" />
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Auth Type</label>
|
||||
<select class="form-select" @bind="_authType">
|
||||
<option>OAuth2</option>
|
||||
<option>Basic</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">TLS Mode</label>
|
||||
<select class="form-select" @bind="_tlsMode">
|
||||
<option>None</option>
|
||||
<option>StartTLS</option>
|
||||
<option>SSL</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label">Credentials</label>
|
||||
<input type="password" class="form-control" @bind="_credentials"
|
||||
@@ -122,6 +132,7 @@
|
||||
private string _host = string.Empty;
|
||||
private int _port = 587;
|
||||
private string _authType = "OAuth2";
|
||||
private string? _tlsMode;
|
||||
private string? _credentials;
|
||||
private string _fromAddress = string.Empty;
|
||||
private string? _formError;
|
||||
@@ -154,6 +165,7 @@
|
||||
_host = string.Empty;
|
||||
_port = 587;
|
||||
_authType = "OAuth2";
|
||||
_tlsMode = "None";
|
||||
_credentials = null;
|
||||
_fromAddress = string.Empty;
|
||||
_formError = null;
|
||||
@@ -166,6 +178,7 @@
|
||||
_host = smtp.Host;
|
||||
_port = smtp.Port;
|
||||
_authType = smtp.AuthType;
|
||||
_tlsMode = smtp.TlsMode;
|
||||
_credentials = smtp.Credentials;
|
||||
_fromAddress = smtp.FromAddress;
|
||||
_formError = null;
|
||||
@@ -194,6 +207,7 @@
|
||||
_editingSmtp.Host = _host.Trim();
|
||||
_editingSmtp.Port = _port;
|
||||
_editingSmtp.AuthType = _authType;
|
||||
_editingSmtp.TlsMode = _tlsMode;
|
||||
_editingSmtp.Credentials = _credentials?.Trim();
|
||||
_editingSmtp.FromAddress = _fromAddress.Trim();
|
||||
await NotificationRepository.UpdateSmtpConfigurationAsync(_editingSmtp);
|
||||
@@ -203,6 +217,7 @@
|
||||
var smtp = new SmtpConfigurationEntity(_host.Trim(), _authType, _fromAddress.Trim())
|
||||
{
|
||||
Port = _port,
|
||||
TlsMode = _tlsMode,
|
||||
Credentials = _credentials?.Trim()
|
||||
};
|
||||
await NotificationRepository.AddSmtpConfigurationAsync(smtp);
|
||||
|
||||
Reference in New Issue
Block a user