Email Rules: Require either recipients or customer email option (#5357)

This commit is contained in:
d11n
2023-09-28 08:36:12 +02:00
committed by GitHub
parent 44a7e9387e
commit 0cfb0ba890
2 changed files with 9 additions and 2 deletions

View File

@@ -62,6 +62,14 @@ namespace BTCPayServer.Controllers
return View(vm);
}
for (var i = 0; index < vm.Rules.Count; index++)
{
var rule = vm.Rules[i];
if (!rule.CustomerEmail && string.IsNullOrEmpty(rule.To))
ModelState.AddModelError($"{nameof(vm.Rules)}[{i}].{nameof(rule.To)}", "Either recipient or \"Send the email to the buyer\" is required");
}
if (!ModelState.IsValid)
{
return View(vm);
@@ -121,7 +129,6 @@ namespace BTCPayServer.Controllers
public bool CustomerEmail { get; set; }
[Required]
[MailboxAddress]
public string To { get; set; }