Reverting changes, validate email only if it was provided

This commit is contained in:
rockstardev
2025-03-05 22:14:06 -06:00
parent 18852af241
commit 1da2cedffd
4 changed files with 9 additions and 9 deletions

View File

@@ -1256,8 +1256,8 @@ namespace BTCPayServer.Controllers
return RedirectToAction(nameof(Emails));
}
// save
if (!MailboxAddressValidator.IsMailboxAddress(model.Settings.From))
// save if user provided valid email; this will also clear settings if no model.Settings.From
if (model.Settings.From is not null && !MailboxAddressValidator.IsMailboxAddress(model.Settings.From))
{
ModelState.AddModelError("Settings.From", StringLocalizer["Invalid email"]);
return View(model);