From 44a8ea6bee3cf3fefc3d290dbaaa8c8e1554868f Mon Sep 17 00:00:00 2001 From: crobibero Date: Wed, 24 Jun 2020 09:45:11 -0600 Subject: [PATCH] implement ChangeEasyPassword from legacy provider --- Jellyfin.Server.Implementations/Users/UserManager.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs index 97ea03596d..55218c5de9 100644 --- a/Jellyfin.Server.Implementations/Users/UserManager.cs +++ b/Jellyfin.Server.Implementations/Users/UserManager.cs @@ -263,7 +263,17 @@ namespace Jellyfin.Server.Implementations.Users /// public void ChangeEasyPassword(User user, string newPassword, string? newPasswordSha1) { - user.EasyPassword = _cryptoProvider.CreatePasswordHash(newPassword).ToString(); + if (newPassword != null) + { + newPasswordSha1 = _cryptoProvider.CreatePasswordHash(newPassword).ToString(); + } + + if (string.IsNullOrWhiteSpace(newPasswordSha1)) + { + throw new ArgumentNullException(nameof(newPasswordSha1)); + } + + user.EasyPassword = newPasswordSha1; UpdateUser(user); OnUserPasswordChanged?.Invoke(this, new GenericEventArgs(user));