mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
refactor: admin users must have a non-empty password
This commit is contained in:
parent
4a9bcbd626
commit
57d8452e2a
@ -278,6 +278,10 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
public async Task ChangePassword(User user, string newPassword)
|
public async Task ChangePassword(User user, string newPassword)
|
||||||
{
|
{
|
||||||
ArgumentNullException.ThrowIfNull(user);
|
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 GetAuthenticationProvider(user).ChangePassword(user, newPassword).ConfigureAwait(false);
|
||||||
await UpdateUserAsync(user).ConfigureAwait(false);
|
await UpdateUserAsync(user).ConfigureAwait(false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user