mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
commit
06db5f8bca
@ -600,18 +600,13 @@ namespace Jellyfin.Server.Implementations.Users
|
|||||||
}
|
}
|
||||||
|
|
||||||
var defaultName = Environment.UserName;
|
var defaultName = Environment.UserName;
|
||||||
if (string.IsNullOrWhiteSpace(defaultName))
|
if (string.IsNullOrWhiteSpace(defaultName) || !IsValidUsername(defaultName))
|
||||||
{
|
{
|
||||||
defaultName = "MyJellyfinUser";
|
defaultName = "MyJellyfinUser";
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogWarning("No users, creating one with username {UserName}", defaultName);
|
_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);
|
var newUser = await CreateUserInternalAsync(defaultName, dbContext).ConfigureAwait(false);
|
||||||
newUser.SetPermission(PermissionKind.IsAdministrator, true);
|
newUser.SetPermission(PermissionKind.IsAdministrator, true);
|
||||||
newUser.SetPermission(PermissionKind.EnableContentDeletion, true);
|
newUser.SetPermission(PermissionKind.EnableContentDeletion, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user