diff options
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)); } } |
