diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations')
3 files changed, 19 insertions, 8 deletions
diff --git a/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs b/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs index f10244a2c2..14a877e784 100644 --- a/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs +++ b/MediaBrowser.Server.Implementations/Devices/DeviceRepository.cs @@ -20,14 +20,15 @@ namespace MediaBrowser.Server.Implementations.Devices private readonly IApplicationPaths _appPaths; private readonly IJsonSerializer _json; - private ILogger _logger; + private readonly ILogger _logger; private ConcurrentBag<DeviceInfo> _devices; - public DeviceRepository(IApplicationPaths appPaths, IJsonSerializer json) + public DeviceRepository(IApplicationPaths appPaths, IJsonSerializer json, ILogger logger) { _appPaths = appPaths; _json = json; + _logger = logger; } private string GetDevicesPath() diff --git a/MediaBrowser.Server.Implementations/Library/UserManager.cs b/MediaBrowser.Server.Implementations/Library/UserManager.cs index f96d9882d0..55311ed8d4 100644 --- a/MediaBrowser.Server.Implementations/Library/UserManager.cs +++ b/MediaBrowser.Server.Implementations/Library/UserManager.cs @@ -528,28 +528,38 @@ namespace MediaBrowser.Server.Implementations.Library /// <returns>Task.</returns> public Task ResetPassword(User user) { - return ChangePassword(user, string.Empty); + return ChangePassword(user, GetSha1String(string.Empty)); } /// <summary> /// Changes the password. /// </summary> /// <param name="user">The user.</param> - /// <param name="newPassword">The new password.</param> + /// <param name="newPasswordSha1">The new password sha1.</param> /// <returns>Task.</returns> - public async Task ChangePassword(User user, string newPassword) + /// <exception cref="System.ArgumentNullException"> + /// user + /// or + /// newPassword + /// </exception> + /// <exception cref="System.ArgumentException">Passwords for guests cannot be changed.</exception> + public async Task ChangePassword(User user, string newPasswordSha1) { if (user == null) { throw new ArgumentNullException("user"); } + if (string.IsNullOrWhiteSpace(newPasswordSha1)) + { + throw new ArgumentNullException("newPasswordSha1"); + } if (user.ConnectLinkType.HasValue && user.ConnectLinkType.Value == UserLinkType.Guest) { throw new ArgumentException("Passwords for guests cannot be changed."); } - user.Password = string.IsNullOrEmpty(newPassword) ? GetSha1String(string.Empty) : GetSha1String(newPassword); + user.Password = newPasswordSha1; await UpdateUser(user).ConfigureAwait(false); diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index bc03470e24..4a42662e19 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -27,7 +27,7 @@ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> - <DebugType>pdbonly</DebugType> + <DebugType>none</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release\</OutputPath> <DefineConstants>TRACE</DefineConstants> @@ -36,7 +36,7 @@ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release Mono|AnyCPU' "> - <DebugType>pdbonly</DebugType> + <DebugType>none</DebugType> <Optimize>true</Optimize> <OutputPath>bin\Release Mono\</OutputPath> <DefineConstants>TRACE</DefineConstants> |
