Merge pull request #3727 from K900/patch-1

Fix #3624
pull/3769/head
Anthony Lavado 4 years ago committed by GitHub
commit 06db5f8bca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -600,18 +600,13 @@ namespace Jellyfin.Server.Implementations.Users
}
var defaultName = Environment.UserName;
if (string.IsNullOrWhiteSpace(defaultName))
if (string.IsNullOrWhiteSpace(defaultName) || !IsValidUsername(defaultName))
{
defaultName = "MyJellyfinUser";
}
_logger.LogWarning("No users, creating one with username {UserName}", defaultName);
if (!IsValidUsername(defaultName))
{
throw new ArgumentException("Provided username is not valid!", defaultName);
}
var newUser = await CreateUserInternalAsync(defaultName, dbContext).ConfigureAwait(false);
newUser.SetPermission(PermissionKind.IsAdministrator, true);
newUser.SetPermission(PermissionKind.EnableContentDeletion, true);

Loading…
Cancel
Save