diff options
author | crupest <crupest@outlook.com> | 2022-04-07 21:52:26 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-04-07 21:52:26 +0800 |
commit | a1f6b41accb47e4c1e1e0474148afa94732377da (patch) | |
tree | 019932d11ab14682f526b7cb9ab1be5a27fbbfdd /BackEnd/Timeline/Models/Validation/NameValidator.cs | |
parent | f8eecd3d50dec23d23b2fa1b6223b9c99d974214 (diff) | |
download | timeline-a1f6b41accb47e4c1e1e0474148afa94732377da.tar.gz timeline-a1f6b41accb47e4c1e1e0474148afa94732377da.tar.bz2 timeline-a1f6b41accb47e4c1e1e0474148afa94732377da.zip |
...
Diffstat (limited to 'BackEnd/Timeline/Models/Validation/NameValidator.cs')
-rw-r--r-- | BackEnd/Timeline/Models/Validation/NameValidator.cs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/BackEnd/Timeline/Models/Validation/NameValidator.cs b/BackEnd/Timeline/Models/Validation/NameValidator.cs index 2220de6f..c7c18738 100644 --- a/BackEnd/Timeline/Models/Validation/NameValidator.cs +++ b/BackEnd/Timeline/Models/Validation/NameValidator.cs @@ -1,4 +1,5 @@ -using System.Linq;
+using System.Collections.Generic;
+using System.Linq;
using System.Text.RegularExpressions;
namespace Timeline.Models.Validation
@@ -7,10 +8,17 @@ namespace Timeline.Models.Validation {
private static Regex UniqueIdRegex { get; } = new Regex(@"^[a-zA-Z0-9]{32}$");
+ public List<string> DisallowedNames { get; set; } = new List<string>();
+
public const int MaxLength = 26;
protected override (bool, string) DoValidate(string value)
{
+ if (DisallowedNames.Contains(value)) + { + return (false, Resource.NameDisallowed); + }
+
if (value.Length == 0)
{
return (false, Resource.NameCantBeEmpty);
|