aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server.Implementations/Users/UserManager.cs
diff options
context:
space:
mode:
authorK900 <me@0upti.me>2020-07-28 12:03:08 +0300
committerGitHub <noreply@github.com>2020-07-28 12:03:08 +0300
commit3ed9463d25776c3a371872183742703d470f871d (patch)
tree4ba661e832ae15f09435848cd425f0e67942c1f0 /Jellyfin.Server.Implementations/Users/UserManager.cs
parentb207907e1b8af2859f3148593e3bfd901ce828ea (diff)
Fix #3624
It doesn't really make sense to throw an error when creating the default user, because the error is completely non-actionable. Instead, if the autodetected username is not valid, just fall back to a sane default.
Diffstat (limited to 'Jellyfin.Server.Implementations/Users/UserManager.cs')
-rw-r--r--Jellyfin.Server.Implementations/Users/UserManager.cs7
1 files changed, 1 insertions, 6 deletions
diff --git a/Jellyfin.Server.Implementations/Users/UserManager.cs b/Jellyfin.Server.Implementations/Users/UserManager.cs
index eaa6a0a81..11402ee05 100644
--- a/Jellyfin.Server.Implementations/Users/UserManager.cs
+++ b/Jellyfin.Server.Implementations/Users/UserManager.cs
@@ -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);