fix(ui): mirror the EWS username:password credentials rule on the SMTP page

This commit is contained in:
Joseph Doherty
2026-08-10 06:53:15 -04:00
parent 3e490f2a7d
commit 82f52e81ce
2 changed files with 60 additions and 0 deletions
@@ -308,6 +308,24 @@
return;
}
// Mirror of the same gate's credentials rule, with the identical FIRST-colon-only
// split: a domain-qualified user name contains no colon but a password may. This
// page has no preserve-if-blank behaviour — the field's value IS what gets
// persisted, and a blank field clears the stored credential — so the rule applies
// on edit as well as add, exactly as the management gate validates the effective row.
if (IsEwsForm)
{
var credentialParts = _credentials?.Trim().Split(':', 2) ?? [];
if (credentialParts.Length != 2
|| credentialParts[0].Length == 0
|| credentialParts[1].Length == 0)
{
_formError = "EWS credentials must be in 'username:password' form "
+ @"(username may be 'domain\username').";
return;
}
}
try
{
if (_editingSmtp != null)