mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-10 17:26:05 +01:00
Email Rules: Require either recipients or customer email option (#5357)
This commit is contained in:
parent
44a7e9387e
commit
0cfb0ba890
2 changed files with 9 additions and 2 deletions
|
@ -62,6 +62,14 @@ namespace BTCPayServer.Controllers
|
||||||
|
|
||||||
return View(vm);
|
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)
|
if (!ModelState.IsValid)
|
||||||
{
|
{
|
||||||
return View(vm);
|
return View(vm);
|
||||||
|
@ -121,7 +129,6 @@ namespace BTCPayServer.Controllers
|
||||||
|
|
||||||
public bool CustomerEmail { get; set; }
|
public bool CustomerEmail { get; set; }
|
||||||
|
|
||||||
[Required]
|
|
||||||
[MailboxAddress]
|
[MailboxAddress]
|
||||||
public string To { get; set; }
|
public string To { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
<div class="form-text">Choose what event sends the email.</div>
|
<div class="form-text">Choose what event sends the email.</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label asp-for="Rules[index].To" class="form-label" data-required>Recipients</label>
|
<label asp-for="Rules[index].To" class="form-label">Recipients</label>
|
||||||
<input type="text" asp-for="Rules[index].To" class="form-control email-rule-to" />
|
<input type="text" asp-for="Rules[index].To" class="form-control email-rule-to" />
|
||||||
<span asp-validation-for="Rules[index].To" class="text-danger"></span>
|
<span asp-validation-for="Rules[index].To" class="text-danger"></span>
|
||||||
<div class="form-text">Who to send the email to. For multiple emails, separate with a comma.</div>
|
<div class="form-text">Who to send the email to. For multiple emails, separate with a comma.</div>
|
||||||
|
|
Loading…
Add table
Reference in a new issue