From a7d650421dd784e6222dc195d58c5b9ea673dff6 Mon Sep 17 00:00:00 2001 From: Evan Goode Date: Sat, 12 Apr 2025 22:24:47 -0400 Subject: [PATCH] fix: AllowChoosingUUID belongs under CreateNewPlayer, not RegistrationNewPlayer --- front_test.go | 4 ++-- player.go | 2 +- user.go | 2 +- view/registration.tmpl | 4 ++-- view/user.tmpl | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/front_test.go b/front_test.go index 910e24b..8272e44 100644 --- a/front_test.go +++ b/front_test.go @@ -208,7 +208,7 @@ func TestFront(t *testing.T) { config := testConfig() config.AllowAddingDeletingPlayers = true - config.RegistrationNewPlayer.AllowChoosingUUID = true + config.CreateNewPlayer.AllowChoosingUUID = true ts.Setup(config) defer ts.Teardown() @@ -468,7 +468,7 @@ func (ts *TestSuite) testRegistrationNewPlayerChosenUUIDNotAllowed(t *testing.T) uuid := "11111111-2222-3333-4444-555555555555" - ts.App.Config.RegistrationNewPlayer.AllowChoosingUUID = false + ts.App.Config.CreateNewPlayer.AllowChoosingUUID = false returnURL := ts.App.FrontEndURL + "/web/registration" form := url.Values{} diff --git a/player.go b/player.go index 75ee992..7a063df 100644 --- a/player.go +++ b/player.go @@ -150,7 +150,7 @@ func (app *App) CreatePlayer( if chosenUUID == nil { playerUUID = uuid.New().String() } else { - if !app.Config.RegistrationNewPlayer.AllowChoosingUUID && !callerIsAdmin { + if !app.Config.CreateNewPlayer.AllowChoosingUUID && !callerIsAdmin { return Player{}, NewBadRequestUserError("Choosing a UUID is not allowed.") } chosenUUIDStruct, err := uuid.Parse(*chosenUUID) diff --git a/user.go b/user.go index e959349..0cc52a1 100644 --- a/user.go +++ b/user.go @@ -191,7 +191,7 @@ func (app *App) CreateUser( if chosenUUID == nil { playerUUID = uuid.New().String() } else { - if !app.Config.RegistrationNewPlayer.AllowChoosingUUID && !callerIsAdmin { + if !app.Config.CreateNewPlayer.AllowChoosingUUID && !callerIsAdmin { return User{}, NewBadRequestUserError("Choosing a UUID is not allowed.") } chosenUUIDStruct, err := uuid.Parse(*chosenUUID) diff --git a/view/registration.tmpl b/view/registration.tmpl index a148488..62a1ecc 100644 --- a/view/registration.tmpl +++ b/view/registration.tmpl @@ -38,7 +38,7 @@ {{ if and .App.Config.RegistrationNewPlayer.RequireInvite (not .InviteCode) }}

Registration as a new player is invite-only.

{{ else }} - {{ if .App.Config.RegistrationNewPlayer.AllowChoosingUUID }} + {{ if .App.Config.CreateNewPlayer.AllowChoosingUUID }}

Register a new account:

{{ else }}

Register a new account with a random UUID:

@@ -65,7 +65,7 @@ class="long" required /> - {{ if .App.Config.RegistrationNewPlayer.AllowChoosingUUID }} + {{ if .App.Config.CreateNewPlayer.AllowChoosingUUID }}

- {{ if or .User.IsAdmin .App.Config.RegistrationNewPlayer.AllowChoosingUUID }} + {{ if or .User.IsAdmin .App.Config.CreateNewPlayer.AllowChoosingUUID }}