This commit is contained in:
Evan Goode 2025-03-29 17:14:07 -04:00
parent 489e0fc587
commit a9b1531111
5 changed files with 9 additions and 14 deletions

View File

@ -1,6 +1,6 @@
services: services:
caddy: caddy:
image: caddy image: docker.io/caddy
ports: ports:
- "80:80" - "80:80"
- "443:443" - "443:443"
@ -9,7 +9,7 @@ services:
- ./caddy/data:/data - ./caddy/data:/data
- ./caddy/config:/config - ./caddy/config:/config
drasl: drasl:
image: unmojang/drasl image: docker.io/unmojang/drasl
volumes: volumes:
- ./config:/etc/drasl - ./config:/etc/drasl
- ./data:/var/lib/drasl - ./data:/var/lib/drasl

View File

@ -1,5 +1,3 @@
version: "3"
services: services:
drasl: drasl:
image: unmojang/drasl image: unmojang/drasl

View File

@ -1314,7 +1314,7 @@ func frontChallenge(app *App, action string) func(c echo.Context) error {
} }
if provider.Config.AllowChoosingPlayerName { if provider.Config.AllowChoosingPlayerName {
playerName = c.FormValue("playerName") playerName = c.QueryParam("playerName")
} else { } else {
if preferredPlayerName, ok := app.getPreferredPlayerName(claims.GetUserInfo()).Get(); ok { if preferredPlayerName, ok := app.getPreferredPlayerName(claims.GetUserInfo()).Get(); ok {
playerName = preferredPlayerName playerName = preferredPlayerName
@ -1323,11 +1323,7 @@ func frontChallenge(app *App, action string) func(c echo.Context) error {
} }
} }
} else { } else {
username := c.QueryParam("username") playerName = c.QueryParam("playerName")
if err := app.ValidateUsername(username); err != nil {
return NewWebError(returnURL, "Invalid username: %s", err)
}
playerName = username
} }
} else if action == ChallengeActionCreatePlayer { } else if action == ChallengeActionCreatePlayer {
playerName = c.QueryParam("playerName") playerName = c.QueryParam("playerName")

View File

@ -589,7 +589,7 @@ func (ts *TestSuite) testRegistrationNewPlayerInvite(t *testing.T) {
func (ts *TestSuite) solveRegisterChallenge(t *testing.T, username string) *http.Cookie { func (ts *TestSuite) solveRegisterChallenge(t *testing.T, username string) *http.Cookie {
// Get challenge skin // Get challenge skin
req := httptest.NewRequest(http.MethodGet, "/web/register-challenge?username="+username, nil) req := httptest.NewRequest(http.MethodGet, "/web/register-challenge?playerName="+username, nil)
rec := httptest.NewRecorder() rec := httptest.NewRecorder()
ts.Server.ServeHTTP(rec, req) ts.Server.ServeHTTP(rec, req)
assert.Equal(t, http.StatusOK, rec.Code) assert.Equal(t, http.StatusOK, rec.Code)
@ -972,12 +972,12 @@ func (ts *TestSuite) testRegistrationExistingPlayerVerification(t *testing.T) {
ts.registrationShouldFail(t, rec, "Couldn't verify your skin, maybe try again: player does not have a skin", returnURL) ts.registrationShouldFail(t, rec, "Couldn't verify your skin, maybe try again: player does not have a skin", returnURL)
} }
{ {
// Get challenge skin with invalid username should fail // Get challenge skin with invalid player name should fail
req := httptest.NewRequest(http.MethodGet, "/web/register-challenge?username=AReallyReallyReallyLongUsername&returnUrl="+ts.App.FrontEndURL+"/web/registration", nil) req := httptest.NewRequest(http.MethodGet, "/web/register-challenge?playerName=AReallyReallyReallyLongPlayerName&returnUrl="+ts.App.FrontEndURL+"/web/registration", nil)
rec := httptest.NewRecorder() rec := httptest.NewRecorder()
ts.Server.ServeHTTP(rec, req) ts.Server.ServeHTTP(rec, req)
assert.Equal(t, http.StatusSeeOther, rec.Code) assert.Equal(t, http.StatusSeeOther, rec.Code)
assert.Equal(t, "Invalid username: neither a valid player name (can't be longer than 16 characters) nor an email address", getErrorMessage(rec)) assert.Equal(t, "Invalid player name: can't be longer than 16 characters", getErrorMessage(rec))
assert.Equal(t, returnURL, rec.Header().Get("Location")) assert.Equal(t, returnURL, rec.Header().Get("Location"))
} }
{ {

View File

@ -496,6 +496,7 @@ func setup(config *Config) *App {
playerCertificateKeys = append(playerCertificateKeys, *publicKey) playerCertificateKeys = append(playerCertificateKeys, *publicKey)
} }
} }
log.Printf("Fetched public keys from fallback API server %s", fallbackAPIServer.Nickname)
} }
// OIDC providers // OIDC providers