mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-13 03:16:46 +01:00
15 lines
496 B
C#
15 lines
496 B
C#
|
#nullable enable
|
||
|
using BTCPayServer.Client.Models;
|
||
|
|
||
|
namespace BTCPayServer
|
||
|
{
|
||
|
public static class ValidationExtensions
|
||
|
{
|
||
|
public static void Validate(this EmailSettingsData request, Microsoft.AspNetCore.Mvc.ModelBinding.ModelStateDictionary modelState)
|
||
|
{
|
||
|
if (!string.IsNullOrEmpty(request.From) && !MailboxAddressValidator.IsMailboxAddress(request.From))
|
||
|
modelState.AddModelError(nameof(request.From), "Invalid email address");
|
||
|
}
|
||
|
}
|
||
|
}
|