diff options
Diffstat (limited to 'Jellyfin.Api/Controllers/StartupController.cs')
| -rw-r--r-- | Jellyfin.Api/Controllers/StartupController.cs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Jellyfin.Api/Controllers/StartupController.cs b/Jellyfin.Api/Controllers/StartupController.cs index 4373a46adc..fa6d9efe36 100644 --- a/Jellyfin.Api/Controllers/StartupController.cs +++ b/Jellyfin.Api/Controllers/StartupController.cs @@ -145,12 +145,14 @@ public class StartupController : BaseJellyfinApiController return BadRequest("Password must not be empty"); } - if (startupUserDto.Name is not null) + await _userManager.UpdateUserAsync(user).ConfigureAwait(false); + +#pragma warning disable CA1309 // Use ordinal string comparison + if (startupUserDto.Name is not null && !startupUserDto.Name.Equals(user.Username, StringComparison.InvariantCultureIgnoreCase)) { - user.Username = startupUserDto.Name; + await _userManager.RenameUser(user.Id, user.Username, startupUserDto.Name).ConfigureAwait(false); } - - await _userManager.UpdateUserAsync(user).ConfigureAwait(false); +#pragma warning restore CA1309 // Use ordinal string comparison if (!string.IsNullOrEmpty(startupUserDto.Password)) { |
