Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/apps/api/Accounts/EmailAddressPolicy.cs
diff options
context:
space:
mode:
authorLeitwolf112026-10-03 18:46:59 +0300
committerLeitwolf112026-10-03 18:46:59 +0300
commitb84a2216c26cc5392d0dc300b7a605ccb288d8c8 (patch)
tree048ae623f49cc5f2f94234d747351f9e659f5267 /apps/api/Accounts/EmailAddressPolicy.cs
parentec774db15976385a6d5ea6f48d3622fe507d3843 (diff)
parentcf444eb3bccf99c10f59ed5330b61c0397e0aeaa (diff)
downloadprogmaweb-fix/api-without-google.tar.gz
Merge remote-tracking branch 'origin/main' into fix/api-without-googlefix/api-without-google
Diffstat (limited to 'apps/api/Accounts/EmailAddressPolicy.cs')
-rw-r--r--apps/api/Accounts/EmailAddressPolicy.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/api/Accounts/EmailAddressPolicy.cs b/apps/api/Accounts/EmailAddressPolicy.cs
index 9710b0c..898d07c 100644
--- a/apps/api/Accounts/EmailAddressPolicy.cs
+++ b/apps/api/Accounts/EmailAddressPolicy.cs
@@ -5,10 +5,22 @@ using System.Net.Mail;
namespace Progmasoft.Progmaweb.Api.Accounts;
+/// <summary>Rules for email addresses.</summary>
+/// <remarks>
+/// An address is accepted when it parses as a single mailbox without a display name and is at most 254 characters
+/// long. Ownership of the address is not verified.
+/// </remarks>
internal static class EmailAddressPolicy
{
+ /// <summary>Most characters an email address may have.</summary>
public const int MaximumLength = 254;
+ /// <summary>Validates an email address and returns its stored and lookup forms.</summary>
+ /// <param name="value">The address as entered; surrounding white space is ignored.</param>
+ /// <param name="canonical">The trimmed address, kept as the owner wrote it.</param>
+ /// <param name="normalized">The address in upper case; the uniqueness key. Empty when the address is refused.</param>
+ /// <param name="error">Message for the user when the address is refused; empty otherwise.</param>
+ /// <returns><see langword="true"/> when the address is a single valid mailbox.</returns>
public static bool TryNormalize(string? value, out string canonical, out string normalized, out string error)
{
canonical = value?.Trim() ?? string.Empty;