aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Users/UserManager.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-06-24 09:45:11 -0600
committercrobibero <cody@robibe.ro>2020-06-24 09:45:11 -0600
commit44a8ea6bee3cf3fefc3d290dbaaa8c8e1554868f (patch)
tree5e1f87a2adb67ac4b5e46eaa88df6d3a042f3f93 /Jellyfin.Server.Implementations/Users/UserManager.cs
parent3169b0af8917ac0bfd189fdb2f261be774b8b869 (diff)
implement ChangeEasyPassword from legacy provider
Diffstat (limited to 'Jellyfin.Server.Implementations/Users/UserManager.cs')
-rw-r--r--Jellyfin.Server.Implementations/Users/UserManager.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs
index 97ea03596..55218c5de 100644
--- a/Jellyfin.Server.Implementations/Users/UserManager.cs
+++ b/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));