소스 검색

implement ChangeEasyPassword from legacy provider

crobibero 5 년 전
부모
커밋
44a8ea6bee
1개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 11 1
      Jellyfin.Server.Implementations/Users/UserManager.cs

+ 11 - 1
Jellyfin.Server.Implementations/Users/UserManager.cs

@@ -263,7 +263,17 @@ namespace Jellyfin.Server.Implementations.Users
         /// <inheritdoc/>
         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>(user));