diff options
| Commit | 12716303151a3f88bfb614132925eca47a9f39dd (patch) | |
|---|---|---|
| Author | 2020-12-09 14:53:15 +0200 | |
| Committer | 2020-12-09 14:53:15 +0200 | |
| Files | dc5f29387ce3b5c13a952f4605e748434f731d8b /Models | |
| DevHive-12716303151a3f88bfb614132925eca47a9f39dd.tar DevHive-12716303151a3f88bfb614132925eca47a9f39dd.tar.gz DevHive-12716303151a3f88bfb614132925eca47a9f39dd.zip | ||
| Parent | c37b614ff35135da4b0560b32470fbcc1c6b51f7 (diff) | |
Fixed User class string validation
1 files changed, 4 insertions, 3 deletions
| -rw-r--r-- | Models/Classes/User.cs | 7 |
diff --git a/Models/Classes/User.cs b/Models/Classes/User.cs index c40a69a..e5a83d6 100644 --- a/Models/Classes/User.cs +++ b/Models/Classes/User.cs @@ -72,9 +72,10 @@ namespace Models.Classes throw new ArgumentException($"{name} length cannot be less than {minLength} and more than {maxLength}."); foreach (char character in value) // more efficient than Linq - { - if (!Char.IsLetter(character) || (canBeDigit && !Char.IsDigit(character))) - throw new ArgumentException($"{name} contains invalid characters."); + { + if (!Char.IsLetter(character)) + if (!(Char.IsDigit(character) && canBeDigit)) + throw new ArgumentException($"{name} contains invalid characters."); } } |
