mirror of
https://github.com/unmojang/drasl.git
synced 2025-08-03 10:56:06 -04:00
Fixups
This commit is contained in:
parent
489e0fc587
commit
a9b1531111
@ -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
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
version: "3"
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
drasl:
|
drasl:
|
||||||
image: unmojang/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 {
|
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")
|
||||||
|
@ -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"))
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
1
main.go
1
main.go
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user