Merge pull request #9821 from cvium/admin_must_have_pw

This commit is contained in:
Cody Robibero
2023-05-29 18:38:01 -06:00
committed by GitHub
2 changed files with 8 additions and 0 deletions

View File

@@ -272,6 +272,10 @@ namespace Jellyfin.Server.Implementations.Users
public async Task ChangePassword(User user, string newPassword)
{
ArgumentNullException.ThrowIfNull(user);
if (user.HasPermission(PermissionKind.IsAdministrator) && string.IsNullOrWhiteSpace(newPassword))
{
throw new ArgumentException("Admin user passwords must not be empty", nameof(newPassword));
}
await GetAuthenticationProvider(user).ChangePassword(user, newPassword).ConfigureAwait(false);
await UpdateUserAsync(user).ConfigureAwait(false);