mirror of
https://github.com/unmojang/drasl.git
synced 2025-08-03 02:46:03 -04:00
Fixups
This commit is contained in:
parent
489e0fc587
commit
a9b1531111
@ -1,6 +1,6 @@
|
||||
services:
|
||||
caddy:
|
||||
image: caddy
|
||||
image: docker.io/caddy
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
@ -9,7 +9,7 @@ services:
|
||||
- ./caddy/data:/data
|
||||
- ./caddy/config:/config
|
||||
drasl:
|
||||
image: unmojang/drasl
|
||||
image: docker.io/unmojang/drasl
|
||||
volumes:
|
||||
- ./config:/etc/drasl
|
||||
- ./data:/var/lib/drasl
|
||||
|
@ -1,5 +1,3 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
drasl:
|
||||
image: unmojang/drasl
|
||||
|
8
front.go
8
front.go
@ -1314,7 +1314,7 @@ func frontChallenge(app *App, action string) func(c echo.Context) error {
|
||||
}
|
||||
|
||||
if provider.Config.AllowChoosingPlayerName {
|
||||
playerName = c.FormValue("playerName")
|
||||
playerName = c.QueryParam("playerName")
|
||||
} else {
|
||||
if preferredPlayerName, ok := app.getPreferredPlayerName(claims.GetUserInfo()).Get(); ok {
|
||||
playerName = preferredPlayerName
|
||||
@ -1323,11 +1323,7 @@ func frontChallenge(app *App, action string) func(c echo.Context) error {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
username := c.QueryParam("username")
|
||||
if err := app.ValidateUsername(username); err != nil {
|
||||
return NewWebError(returnURL, "Invalid username: %s", err)
|
||||
}
|
||||
playerName = username
|
||||
playerName = c.QueryParam("playerName")
|
||||
}
|
||||
} else if action == ChallengeActionCreatePlayer {
|
||||
playerName = c.QueryParam("playerName")
|
||||
|
@ -589,7 +589,7 @@ func (ts *TestSuite) testRegistrationNewPlayerInvite(t *testing.T) {
|
||||
|
||||
func (ts *TestSuite) solveRegisterChallenge(t *testing.T, username string) *http.Cookie {
|
||||
// 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()
|
||||
ts.Server.ServeHTTP(rec, req)
|
||||
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)
|
||||
}
|
||||
{
|
||||
// Get challenge skin with invalid username should fail
|
||||
req := httptest.NewRequest(http.MethodGet, "/web/register-challenge?username=AReallyReallyReallyLongUsername&returnUrl="+ts.App.FrontEndURL+"/web/registration", nil)
|
||||
// Get challenge skin with invalid player name should fail
|
||||
req := httptest.NewRequest(http.MethodGet, "/web/register-challenge?playerName=AReallyReallyReallyLongPlayerName&returnUrl="+ts.App.FrontEndURL+"/web/registration", nil)
|
||||
rec := httptest.NewRecorder()
|
||||
ts.Server.ServeHTTP(rec, req)
|
||||
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"))
|
||||
}
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user