From a8388e12c161681ed131462ad713293d3b021b7c Mon Sep 17 00:00:00 2001 From: ta264 Date: Tue, 27 Apr 2021 19:26:25 +0100 Subject: [PATCH] Remove legacy code that accessed config.xml without a lock (cherry picked from commit 7a4adea14ae18a5204226237eded56005a76893e) (cherry picked from commit ba9aab1640358b4097997b6cd32e2edc36a5f696) --- .../Authentication/UserService.cs | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/src/NzbDrone.Core/Authentication/UserService.cs b/src/NzbDrone.Core/Authentication/UserService.cs index 55e5ef350..6db5c8d2c 100644 --- a/src/NzbDrone.Core/Authentication/UserService.cs +++ b/src/NzbDrone.Core/Authentication/UserService.cs @@ -19,7 +19,7 @@ namespace NzbDrone.Core.Authentication User FindUser(Guid identifier); } - public class UserService : IUserService, IHandle + public class UserService : IUserService { private readonly IUserRepository _repo; private readonly IAppFolderInfo _appFolderInfo; @@ -97,35 +97,5 @@ namespace NzbDrone.Core.Authentication { return _repo.FindUser(identifier); } - - public void Handle(ApplicationStartedEvent message) - { - if (_repo.All().Any()) - { - return; - } - - var configFile = _appFolderInfo.GetConfigPath(); - - if (!_diskProvider.FileExists(configFile)) - { - return; - } - - var xDoc = XDocument.Load(configFile); - var config = xDoc.Descendants("Config").Single(); - var usernameElement = config.Descendants("Username").FirstOrDefault(); - var passwordElement = config.Descendants("Password").FirstOrDefault(); - - if (usernameElement == null || passwordElement == null) - { - return; - } - - var username = usernameElement.Value; - var password = passwordElement.Value; - - Add(username, password); - } } }