fix: AllowChoosingUUID belongs under CreateNewPlayer, not RegistrationNewPlayer

This commit is contained in:
Evan Goode 2025-04-12 22:24:47 -04:00
parent e82e6f7117
commit 415bff18c0
5 changed files with 7 additions and 7 deletions

View File

@ -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{}

View File

@ -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)

View File

@ -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)

View File

@ -38,7 +38,7 @@
{{ if and .App.Config.RegistrationNewPlayer.RequireInvite (not .InviteCode) }}
<p>Registration as a new player is invite-only.</p>
{{ else }}
{{ if .App.Config.RegistrationNewPlayer.AllowChoosingUUID }}
{{ if .App.Config.CreateNewPlayer.AllowChoosingUUID }}
<p>Register a new account:</p>
{{ else }}
<p>Register a new account with a random UUID:</p>
@ -65,7 +65,7 @@
class="long"
required
/>
{{ if .App.Config.RegistrationNewPlayer.AllowChoosingUUID }}
{{ if .App.Config.CreateNewPlayer.AllowChoosingUUID }}
<p>
<input
class="long"

View File

@ -108,7 +108,7 @@
maxlength="{{ .App.Constants.MaxPlayerNameLength }}"
required
/>
{{ if or .User.IsAdmin .App.Config.RegistrationNewPlayer.AllowChoosingUUID }}
{{ if or .User.IsAdmin .App.Config.CreateNewPlayer.AllowChoosingUUID }}
<input
class="long"
type="text"