|
|
@ -148,7 +148,7 @@ namespace Jellyfin.Server.Implementations.Users
|
|
|
|
throw new ArgumentException("The new and old names must be different.");
|
|
|
|
throw new ArgumentException("The new and old names must be different.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (Users.Any(u => u.Id != user.Id && u.Username.Equals(newName, StringComparison.Ordinal)))
|
|
|
|
if (Users.Any(u => u.Id != user.Id && u.Username.Equals(newName, StringComparison.OrdinalIgnoreCase)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw new ArgumentException(string.Format(
|
|
|
|
throw new ArgumentException(string.Format(
|
|
|
|
CultureInfo.InvariantCulture,
|
|
|
|
CultureInfo.InvariantCulture,
|
|
|
@ -207,6 +207,14 @@ namespace Jellyfin.Server.Implementations.Users
|
|
|
|
throw new ArgumentException("Usernames can contain unicode symbols, numbers (0-9), dashes (-), underscores (_), apostrophes ('), and periods (.)");
|
|
|
|
throw new ArgumentException("Usernames can contain unicode symbols, numbers (0-9), dashes (-), underscores (_), apostrophes ('), and periods (.)");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (Users.Any(u => u.Username.Equals(name, StringComparison.OrdinalIgnoreCase)))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
throw new ArgumentException(string.Format(
|
|
|
|
|
|
|
|
CultureInfo.InvariantCulture,
|
|
|
|
|
|
|
|
"A user with the name '{0}' already exists.",
|
|
|
|
|
|
|
|
name));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
await using var dbContext = _dbProvider.CreateContext();
|
|
|
|
await using var dbContext = _dbProvider.CreateContext();
|
|
|
|
|
|
|
|
|
|
|
|
var newUser = await CreateUserInternalAsync(name, dbContext).ConfigureAwait(false);
|
|
|
|
var newUser = await CreateUserInternalAsync(name, dbContext).ConfigureAwait(false);
|
|
|
|