diff options
| author | Bond-009 <bond.009@outlook.com> | 2019-02-02 21:45:29 +0100 |
|---|---|---|
| committer | Bond-009 <bond.009@outlook.com> | 2019-02-02 21:45:29 +0100 |
| commit | 78e4e2ed929155b433fc0cbb2ea6fc7f64411a72 (patch) | |
| tree | f0855bf99a5e177a80297feae3dbed40c4543630 /Emby.Server.Implementations/Library/UserManager.cs | |
| parent | 42d5a48491904ae4251e32c17da037a1a5ba77eb (diff) | |
Fix all warnings
Diffstat (limited to 'Emby.Server.Implementations/Library/UserManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/UserManager.cs | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs index b33ae72b7..215978341 100644 --- a/Emby.Server.Implementations/Library/UserManager.cs +++ b/Emby.Server.Implementations/Library/UserManager.cs @@ -448,30 +448,30 @@ namespace Emby.Server.Implementations.Library private void UpdateInvalidLoginAttemptCount(User user, int newValue) { - if (user.Policy.InvalidLoginAttemptCount != newValue || newValue > 0) + if (user.Policy.InvalidLoginAttemptCount == newValue || newValue <= 0) { - user.Policy.InvalidLoginAttemptCount = newValue; + return; + } - var maxCount = user.Policy.IsAdministrator ? 3 : 5; + user.Policy.InvalidLoginAttemptCount = newValue; - // TODO: Fix - /* - var fireLockout = false; + var maxCount = user.Policy.IsAdministrator ? 3 : 5; - if (newValue >= maxCount) - { - _logger.LogDebug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue.ToString(CultureInfo.InvariantCulture)); - user.Policy.IsDisabled = true; + var fireLockout = false; - fireLockout = true; - }*/ + if (newValue >= maxCount) + { + _logger.LogDebug("Disabling user {0} due to {1} unsuccessful login attempts.", user.Name, newValue); + user.Policy.IsDisabled = true; - UpdateUserPolicy(user, user.Policy, false); + fireLockout = true; + } - /* if (fireLockout) - { - UserLockedOut?.Invoke(this, new GenericEventArgs<User>(user)); - }*/ + UpdateUserPolicy(user, user.Policy, false); + + if (fireLockout) + { + UserLockedOut?.Invoke(this, new GenericEventArgs<User>(user)); } } |
