Add live TLS certificate probing and improve restart error handling.
Configure CertificateCheckUrl per container for curl-like TLS checks, classify Sonic permission errors, and extend setup wizard for container management. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -8,6 +8,7 @@ public sealed class AddCredentialProfileForm : Form
|
||||
{
|
||||
private readonly SetupCoordinator _coordinator;
|
||||
private readonly SonicSystemOption _system;
|
||||
private readonly SonicCredentialProfile? _existing;
|
||||
|
||||
private readonly TextBox _txtProfileName;
|
||||
private readonly TextBox _txtUserName;
|
||||
@@ -16,6 +17,7 @@ public sealed class AddCredentialProfileForm : Form
|
||||
private readonly CheckBox _chkDefault;
|
||||
private readonly Button _btnSave;
|
||||
private readonly Button _btnCancel;
|
||||
private readonly Label _lblPasswordHint;
|
||||
|
||||
private bool _operationRunning;
|
||||
|
||||
@@ -25,9 +27,12 @@ public sealed class AddCredentialProfileForm : Form
|
||||
private set;
|
||||
}
|
||||
|
||||
public bool IsEditMode => _existing is not null;
|
||||
|
||||
public AddCredentialProfileForm(
|
||||
SetupCoordinator coordinator,
|
||||
SonicSystemOption system)
|
||||
SonicSystemOption system,
|
||||
SonicCredentialProfile? existing = null)
|
||||
{
|
||||
_coordinator =
|
||||
coordinator
|
||||
@@ -39,13 +44,17 @@ public sealed class AddCredentialProfileForm : Form
|
||||
?? throw new ArgumentNullException(
|
||||
nameof(system));
|
||||
|
||||
Text = "Benutzerprofil hinzufügen";
|
||||
_existing = existing;
|
||||
|
||||
Text = IsEditMode
|
||||
? "Benutzerprofil bearbeiten"
|
||||
: "Benutzerprofil hinzufügen";
|
||||
|
||||
StartPosition =
|
||||
FormStartPosition.CenterParent;
|
||||
|
||||
ClientSize =
|
||||
new Size(560, 525);
|
||||
new Size(560, 545);
|
||||
|
||||
FormBorderStyle =
|
||||
FormBorderStyle.FixedDialog;
|
||||
@@ -65,8 +74,9 @@ public sealed class AddCredentialProfileForm : Form
|
||||
|
||||
Label title = new()
|
||||
{
|
||||
Text =
|
||||
$"Profil für {_system.ConnectionName}",
|
||||
Text = IsEditMode
|
||||
? $"Profil bearbeiten · {_system.ConnectionName}"
|
||||
: $"Profil für {_system.ConnectionName}",
|
||||
|
||||
Location =
|
||||
new Point(28, 22),
|
||||
@@ -112,7 +122,7 @@ public sealed class AddCredentialProfileForm : Form
|
||||
CreateTextBox(185);
|
||||
|
||||
_txtProfileName.Text =
|
||||
"Administrator";
|
||||
_existing?.CredentialName ?? "Administrator";
|
||||
|
||||
Label userLabel =
|
||||
CreateLabel(
|
||||
@@ -123,7 +133,7 @@ public sealed class AddCredentialProfileForm : Form
|
||||
CreateTextBox(250);
|
||||
|
||||
_txtUserName.Text =
|
||||
"Administrator";
|
||||
_existing?.UserName ?? "Administrator";
|
||||
|
||||
Label passwordLabel =
|
||||
CreateLabel(
|
||||
@@ -136,13 +146,25 @@ public sealed class AddCredentialProfileForm : Form
|
||||
_txtPassword.UseSystemPasswordChar =
|
||||
true;
|
||||
|
||||
_lblPasswordHint = new Label
|
||||
{
|
||||
Text = IsEditMode
|
||||
? "Leer lassen = bisheriges Kennwort behalten"
|
||||
: string.Empty,
|
||||
|
||||
Location = new Point(30, 343),
|
||||
AutoSize = true,
|
||||
ForeColor = Color.FromArgb(169, 184, 200),
|
||||
Font = new Font("Segoe UI", 8.5f)
|
||||
};
|
||||
|
||||
Label repeatLabel =
|
||||
CreateLabel(
|
||||
"Kennwort wiederholen",
|
||||
355);
|
||||
365);
|
||||
|
||||
_txtPasswordRepeat =
|
||||
CreateTextBox(380);
|
||||
CreateTextBox(390);
|
||||
|
||||
_txtPasswordRepeat.UseSystemPasswordChar =
|
||||
true;
|
||||
@@ -153,10 +175,10 @@ public sealed class AddCredentialProfileForm : Form
|
||||
"Als Standardprofil verwenden",
|
||||
|
||||
Location =
|
||||
new Point(30, 425),
|
||||
new Point(30, 435),
|
||||
|
||||
AutoSize = true,
|
||||
Checked = true,
|
||||
Checked = _existing?.IsDefault ?? true,
|
||||
|
||||
ForeColor =
|
||||
Color.FromArgb(241, 245, 249)
|
||||
@@ -167,7 +189,7 @@ public sealed class AddCredentialProfileForm : Form
|
||||
Text = "Abbrechen",
|
||||
|
||||
Location =
|
||||
new Point(125, 465),
|
||||
new Point(125, 480),
|
||||
|
||||
Size =
|
||||
new Size(110, 38),
|
||||
@@ -189,11 +211,12 @@ public sealed class AddCredentialProfileForm : Form
|
||||
|
||||
_btnSave = new Button
|
||||
{
|
||||
Text =
|
||||
"Verbindung prüfen und hinzufügen",
|
||||
Text = IsEditMode
|
||||
? "Prüfen und speichern"
|
||||
: "Verbindung prüfen und hinzufügen",
|
||||
|
||||
Location =
|
||||
new Point(245, 465),
|
||||
new Point(245, 480),
|
||||
|
||||
Size =
|
||||
new Size(280, 38),
|
||||
@@ -228,6 +251,7 @@ public sealed class AddCredentialProfileForm : Form
|
||||
Controls.Add(_txtUserName);
|
||||
Controls.Add(passwordLabel);
|
||||
Controls.Add(_txtPassword);
|
||||
Controls.Add(_lblPasswordHint);
|
||||
Controls.Add(repeatLabel);
|
||||
Controls.Add(_txtPasswordRepeat);
|
||||
Controls.Add(_chkDefault);
|
||||
@@ -328,7 +352,7 @@ public sealed class AddCredentialProfileForm : Form
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(password))
|
||||
if (!IsEditMode && string.IsNullOrEmpty(password))
|
||||
{
|
||||
ShowWarning("Kennwort fehlt.");
|
||||
|
||||
@@ -344,7 +368,8 @@ public sealed class AddCredentialProfileForm : Form
|
||||
return;
|
||||
}
|
||||
|
||||
if (!string.Equals(
|
||||
if (!string.IsNullOrEmpty(password)
|
||||
&& !string.Equals(
|
||||
password,
|
||||
passwordRepeat,
|
||||
StringComparison.Ordinal))
|
||||
@@ -372,13 +397,27 @@ public sealed class AddCredentialProfileForm : Form
|
||||
|
||||
try
|
||||
{
|
||||
CreatedProfile =
|
||||
await _coordinator.AddCredentialAsync(
|
||||
_system,
|
||||
profileName,
|
||||
userName,
|
||||
password,
|
||||
_chkDefault.Checked);
|
||||
if (IsEditMode && _existing is not null)
|
||||
{
|
||||
CreatedProfile =
|
||||
await _coordinator.UpdateCredentialAsync(
|
||||
_system,
|
||||
_existing,
|
||||
profileName,
|
||||
userName,
|
||||
password,
|
||||
_chkDefault.Checked);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreatedProfile =
|
||||
await _coordinator.TestAndAddCredentialAsync(
|
||||
_system,
|
||||
profileName,
|
||||
userName,
|
||||
password,
|
||||
_chkDefault.Checked);
|
||||
}
|
||||
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
@@ -391,7 +430,11 @@ public sealed class AddCredentialProfileForm : Form
|
||||
{
|
||||
MessageBox.Show(
|
||||
this,
|
||||
"Profil konnte nicht angelegt werden.",
|
||||
string.IsNullOrWhiteSpace(exception.Message)
|
||||
? (IsEditMode
|
||||
? "Profil konnte nicht aktualisiert werden."
|
||||
: "Profil konnte nicht angelegt werden.")
|
||||
: exception.Message,
|
||||
"Benutzerprofil",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
@@ -423,7 +466,9 @@ public sealed class AddCredentialProfileForm : Form
|
||||
_btnSave.Text =
|
||||
isRunning
|
||||
? "Verbindung wird geprüft ..."
|
||||
: "Verbindung prüfen und hinzufügen";
|
||||
: IsEditMode
|
||||
? "Prüfen und speichern"
|
||||
: "Verbindung prüfen und hinzufügen";
|
||||
}
|
||||
|
||||
private void ShowWarning(string message)
|
||||
@@ -435,4 +480,4 @@ public sealed class AddCredentialProfileForm : Form
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Warning);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user