Fix all warnings

This commit is contained in:
Bond-009
2019-02-02 21:45:29 +01:00
parent 42d5a48491
commit 78e4e2ed92
5 changed files with 31 additions and 45 deletions

View File

@@ -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));
}
}