aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/Library')
-rw-r--r--Emby.Server.Implementations/Library/MediaSourceManager.cs4
-rw-r--r--Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs7
-rw-r--r--Emby.Server.Implementations/Library/UserManager.cs34
3 files changed, 21 insertions, 24 deletions
diff --git a/Emby.Server.Implementations/Library/MediaSourceManager.cs b/Emby.Server.Implementations/Library/MediaSourceManager.cs
index 4f72651d4..24ab8e761 100644
--- a/Emby.Server.Implementations/Library/MediaSourceManager.cs
+++ b/Emby.Server.Implementations/Library/MediaSourceManager.cs
@@ -20,7 +20,6 @@ using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Serialization;
-using MediaBrowser.Model.Threading;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Library
@@ -36,7 +35,6 @@ namespace Emby.Server.Implementations.Library
private IMediaSourceProvider[] _providers;
private readonly ILogger _logger;
private readonly IUserDataManager _userDataManager;
- private readonly ITimerFactory _timerFactory;
private readonly Func<IMediaEncoder> _mediaEncoder;
private ILocalizationManager _localizationManager;
private IApplicationPaths _appPaths;
@@ -51,7 +49,6 @@ namespace Emby.Server.Implementations.Library
IJsonSerializer jsonSerializer,
IFileSystem fileSystem,
IUserDataManager userDataManager,
- ITimerFactory timerFactory,
Func<IMediaEncoder> mediaEncoder)
{
_itemRepo = itemRepo;
@@ -61,7 +58,6 @@ namespace Emby.Server.Implementations.Library
_jsonSerializer = jsonSerializer;
_fileSystem = fileSystem;
_userDataManager = userDataManager;
- _timerFactory = timerFactory;
_mediaEncoder = mediaEncoder;
_localizationManager = localizationManager;
_appPaths = applicationPaths;
diff --git a/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs b/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs
index 9de766767..a3298c580 100644
--- a/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs
+++ b/Emby.Server.Implementations/Library/Resolvers/PhotoResolver.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.IO;
using System.Linq;
using MediaBrowser.Controller.Drawing;
@@ -85,7 +86,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
return false;
}
- private static readonly string[] IgnoreFiles =
+ private static readonly HashSet<string> IgnoreFiles = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"folder",
"thumb",
@@ -102,7 +103,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
{
var filename = Path.GetFileNameWithoutExtension(path) ?? string.Empty;
- if (IgnoreFiles.Contains(filename, StringComparer.OrdinalIgnoreCase))
+ if (IgnoreFiles.Contains(filename))
{
return false;
}
@@ -112,7 +113,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
return false;
}
- return imageProcessor.SupportedInputFormats.Contains((Path.GetExtension(path) ?? string.Empty).TrimStart('.'), StringComparer.OrdinalIgnoreCase);
+ return imageProcessor.SupportedInputFormats.Contains((Path.GetExtension(path) ?? string.Empty).TrimStart('.'));
}
}
diff --git a/Emby.Server.Implementations/Library/UserManager.cs b/Emby.Server.Implementations/Library/UserManager.cs
index 6dd9366b0..3ff84382f 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));
}
}