2
0
Эх сурвалжийг харах

Revert "Merge pull request #13604 from Jxiced/master"

This reverts commit ce78af2ed4f203690a0f9ef87b08b27a6bd43f63, reversing
changes made to db7465e83d9cc07134a0bffad7ed17b1c7b873da.
Bond_009 4 өдөр өмнө
parent
commit
c7c7b30d28

+ 0 - 1
CONTRIBUTORS.md

@@ -197,7 +197,6 @@
  - [Kenneth Cochran](https://github.com/kennethcochran)
  - [Kenneth Cochran](https://github.com/kennethcochran)
  - [benedikt257](https://github.com/benedikt257)
  - [benedikt257](https://github.com/benedikt257)
  - [revam](https://github.com/revam)
  - [revam](https://github.com/revam)
- - [Jxiced](https://github.com/Jxiced)
  - [allesmi](https://github.com/allesmi)
  - [allesmi](https://github.com/allesmi)
  - [ThunderClapLP](https://github.com/ThunderClapLP)
  - [ThunderClapLP](https://github.com/ThunderClapLP)
  - [Shoham Peller](https://github.com/spellr)
  - [Shoham Peller](https://github.com/spellr)

+ 4 - 5
Jellyfin.Api/Controllers/StartupController.cs

@@ -1,4 +1,3 @@
-using System;
 using System.ComponentModel.DataAnnotations;
 using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Linq;
 using System.Threading.Tasks;
 using System.Threading.Tasks;
@@ -132,16 +131,16 @@ public class StartupController : BaseJellyfinApiController
     [ProducesResponseType(StatusCodes.Status204NoContent)]
     [ProducesResponseType(StatusCodes.Status204NoContent)]
     public async Task<ActionResult> UpdateStartupUser([FromBody] StartupUserDto startupUserDto)
     public async Task<ActionResult> UpdateStartupUser([FromBody] StartupUserDto startupUserDto)
     {
     {
-        ArgumentNullException.ThrowIfNull(startupUserDto.Name);
-        _userManager.ThrowIfInvalidUsername(startupUserDto.Name);
-
         var user = _userManager.Users.First();
         var user = _userManager.Users.First();
         if (string.IsNullOrWhiteSpace(startupUserDto.Password))
         if (string.IsNullOrWhiteSpace(startupUserDto.Password))
         {
         {
             return BadRequest("Password must not be empty");
             return BadRequest("Password must not be empty");
         }
         }
 
 
-        user.Username = startupUserDto.Name;
+        if (startupUserDto.Name is not null)
+        {
+            user.Username = startupUserDto.Name;
+        }
 
 
         await _userManager.UpdateUserAsync(user).ConfigureAwait(false);
         await _userManager.UpdateUserAsync(user).ConfigureAwait(false);
 
 

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

@@ -744,8 +744,7 @@ namespace Jellyfin.Server.Implementations.Users
             _users[user.Id] = user;
             _users[user.Id] = user;
         }
         }
 
 
-        /// <inheritdoc/>
-        public void ThrowIfInvalidUsername(string name)
+        internal static void ThrowIfInvalidUsername(string name)
         {
         {
             if (!string.IsNullOrWhiteSpace(name) && ValidUsernameRegex().IsMatch(name))
             if (!string.IsNullOrWhiteSpace(name) && ValidUsernameRegex().IsMatch(name))
             {
             {

+ 0 - 6
MediaBrowser.Controller/Library/IUserManager.cs

@@ -33,12 +33,6 @@ namespace MediaBrowser.Controller.Library
         /// <value>The users ids.</value>
         /// <value>The users ids.</value>
         IEnumerable<Guid> UsersIds { get; }
         IEnumerable<Guid> UsersIds { get; }
 
 
-        /// <summary>
-        /// Checks if the user's username is valid.
-        /// </summary>
-        /// <param name="name">The user's username.</param>
-        void ThrowIfInvalidUsername(string name);
-
         /// <summary>
         /// <summary>
         /// Initializes the user manager and ensures that a user exists.
         /// Initializes the user manager and ensures that a user exists.
         /// </summary>
         /// </summary>