fix crypto.randomUUID() is not a function in an insecure context
This commit is contained in:
parent
25a3adea2a
commit
61f90b99af
2 changed files with 6 additions and 2 deletions
|
@ -24,7 +24,10 @@ internal static class Endpoints
|
|||
if (name.Length > 12)
|
||||
return Results.BadRequest("name too long");
|
||||
|
||||
var player = playerService.GetOrAdd(name, id ?? Guid.NewGuid());
|
||||
if (!id.HasValue || id.Value == Guid.Empty)
|
||||
id = Guid.NewGuid();
|
||||
|
||||
var player = playerService.GetOrAdd(name, id.Value);
|
||||
return player != null
|
||||
? Results.Ok(new NameId(player.Name, player.Id))
|
||||
: Results.Unauthorized();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue