mirror of
https://github.com/unmojang/drasl.git
synced 2025-08-04 03:16:05 -04:00
fix: AllowChoosingUUID belongs under CreateNewPlayer, not RegistrationNewPlayer
This commit is contained in:
parent
e82e6f7117
commit
a7d650421d
@ -208,7 +208,7 @@ func TestFront(t *testing.T) {
|
|||||||
|
|
||||||
config := testConfig()
|
config := testConfig()
|
||||||
config.AllowAddingDeletingPlayers = true
|
config.AllowAddingDeletingPlayers = true
|
||||||
config.RegistrationNewPlayer.AllowChoosingUUID = true
|
config.CreateNewPlayer.AllowChoosingUUID = true
|
||||||
ts.Setup(config)
|
ts.Setup(config)
|
||||||
defer ts.Teardown()
|
defer ts.Teardown()
|
||||||
|
|
||||||
@ -468,7 +468,7 @@ func (ts *TestSuite) testRegistrationNewPlayerChosenUUIDNotAllowed(t *testing.T)
|
|||||||
|
|
||||||
uuid := "11111111-2222-3333-4444-555555555555"
|
uuid := "11111111-2222-3333-4444-555555555555"
|
||||||
|
|
||||||
ts.App.Config.RegistrationNewPlayer.AllowChoosingUUID = false
|
ts.App.Config.CreateNewPlayer.AllowChoosingUUID = false
|
||||||
|
|
||||||
returnURL := ts.App.FrontEndURL + "/web/registration"
|
returnURL := ts.App.FrontEndURL + "/web/registration"
|
||||||
form := url.Values{}
|
form := url.Values{}
|
||||||
|
@ -150,7 +150,7 @@ func (app *App) CreatePlayer(
|
|||||||
if chosenUUID == nil {
|
if chosenUUID == nil {
|
||||||
playerUUID = uuid.New().String()
|
playerUUID = uuid.New().String()
|
||||||
} else {
|
} else {
|
||||||
if !app.Config.RegistrationNewPlayer.AllowChoosingUUID && !callerIsAdmin {
|
if !app.Config.CreateNewPlayer.AllowChoosingUUID && !callerIsAdmin {
|
||||||
return Player{}, NewBadRequestUserError("Choosing a UUID is not allowed.")
|
return Player{}, NewBadRequestUserError("Choosing a UUID is not allowed.")
|
||||||
}
|
}
|
||||||
chosenUUIDStruct, err := uuid.Parse(*chosenUUID)
|
chosenUUIDStruct, err := uuid.Parse(*chosenUUID)
|
||||||
|
2
user.go
2
user.go
@ -191,7 +191,7 @@ func (app *App) CreateUser(
|
|||||||
if chosenUUID == nil {
|
if chosenUUID == nil {
|
||||||
playerUUID = uuid.New().String()
|
playerUUID = uuid.New().String()
|
||||||
} else {
|
} else {
|
||||||
if !app.Config.RegistrationNewPlayer.AllowChoosingUUID && !callerIsAdmin {
|
if !app.Config.CreateNewPlayer.AllowChoosingUUID && !callerIsAdmin {
|
||||||
return User{}, NewBadRequestUserError("Choosing a UUID is not allowed.")
|
return User{}, NewBadRequestUserError("Choosing a UUID is not allowed.")
|
||||||
}
|
}
|
||||||
chosenUUIDStruct, err := uuid.Parse(*chosenUUID)
|
chosenUUIDStruct, err := uuid.Parse(*chosenUUID)
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
{{ if and .App.Config.RegistrationNewPlayer.RequireInvite (not .InviteCode) }}
|
{{ if and .App.Config.RegistrationNewPlayer.RequireInvite (not .InviteCode) }}
|
||||||
<p>Registration as a new player is invite-only.</p>
|
<p>Registration as a new player is invite-only.</p>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
{{ if .App.Config.RegistrationNewPlayer.AllowChoosingUUID }}
|
{{ if .App.Config.CreateNewPlayer.AllowChoosingUUID }}
|
||||||
<p>Register a new account:</p>
|
<p>Register a new account:</p>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<p>Register a new account with a random UUID:</p>
|
<p>Register a new account with a random UUID:</p>
|
||||||
@ -65,7 +65,7 @@
|
|||||||
class="long"
|
class="long"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
{{ if .App.Config.RegistrationNewPlayer.AllowChoosingUUID }}
|
{{ if .App.Config.CreateNewPlayer.AllowChoosingUUID }}
|
||||||
<p>
|
<p>
|
||||||
<input
|
<input
|
||||||
class="long"
|
class="long"
|
||||||
|
@ -108,7 +108,7 @@
|
|||||||
maxlength="{{ .App.Constants.MaxPlayerNameLength }}"
|
maxlength="{{ .App.Constants.MaxPlayerNameLength }}"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
{{ if or .User.IsAdmin .App.Config.RegistrationNewPlayer.AllowChoosingUUID }}
|
{{ if or .User.IsAdmin .App.Config.CreateNewPlayer.AllowChoosingUUID }}
|
||||||
<input
|
<input
|
||||||
class="long"
|
class="long"
|
||||||
type="text"
|
type="text"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user