1
0
mirror of https://github.com/bitwarden/server synced 2025-12-26 13:13:24 +00:00
Files
server/src/Core/Utilities/StrictEmailAddressAttribute.cs
2025-07-08 10:25:59 -04:00

21 lines
583 B
C#

// FIXME: Update this file to be null safe and then delete the line below
#nullable disable
using System.ComponentModel.DataAnnotations;
namespace Bit.Core.Utilities;
public class StrictEmailAddressAttribute : ValidationAttribute
{
public StrictEmailAddressAttribute()
: base("The {0} field is not a supported e-mail address format.")
{ }
public override bool IsValid(object value)
{
var emailAddress = value?.ToString() ?? string.Empty;
return emailAddress.IsValidEmail() && new EmailAddressAttribute().IsValid(emailAddress);
}
}