diff --git a/clientapi/routing/login.go b/clientapi/routing/login.go index 0de324da1..778c8c0c3 100644 --- a/clientapi/routing/login.go +++ b/clientapi/routing/login.go @@ -23,15 +23,13 @@ import ( "github.com/matrix-org/dendrite/clientapi/userutil" "github.com/matrix-org/dendrite/setup/config" userapi "github.com/matrix-org/dendrite/userapi/api" - "github.com/matrix-org/gomatrixserverlib" "github.com/matrix-org/util" ) type loginResponse struct { - UserID string `json:"user_id"` - AccessToken string `json:"access_token"` - HomeServer gomatrixserverlib.ServerName `json:"home_server"` - DeviceID string `json:"device_id"` + UserID string `json:"user_id"` + AccessToken string `json:"access_token"` + DeviceID string `json:"device_id"` } type flows struct { @@ -116,7 +114,6 @@ func completeAuth( JSON: loginResponse{ UserID: performRes.Device.UserID, AccessToken: performRes.Device.AccessToken, - HomeServer: serverName, DeviceID: performRes.Device.ID, }, } diff --git a/clientapi/routing/register.go b/clientapi/routing/register.go index 04cf5fb61..7821f2c49 100644 --- a/clientapi/routing/register.go +++ b/clientapi/routing/register.go @@ -322,7 +322,7 @@ func validatePassword(password string) *util.JSONResponse { Code: http.StatusBadRequest, JSON: jsonerror.BadJSON(fmt.Sprintf("'password' >%d characters", maxPasswordLength)), } - } else if len(password) < minPasswordLength { + } else if len(password) > 0 && len(password) < minPasswordLength { return &util.JSONResponse{ Code: http.StatusBadRequest, JSON: jsonerror.WeakPassword(fmt.Sprintf("password too weak: min %d chars", minPasswordLength)), diff --git a/clientapi/routing/register_test.go b/clientapi/routing/register_test.go index 3ecb2d868..d44231028 100644 --- a/clientapi/routing/register_test.go +++ b/clientapi/routing/register_test.go @@ -350,13 +350,6 @@ func Test_validatePassword(t *testing.T) { password string want *util.JSONResponse }{ - { - name: "no password supplied", - want: &util.JSONResponse{ - Code: http.StatusBadRequest, - JSON: jsonerror.WeakPassword(fmt.Sprintf("password too weak: min %d chars", minPasswordLength)), - }, - }, { name: "password too short", password: "shortpw", @@ -462,16 +455,6 @@ func Test_register(t *testing.T) { JSON: jsonerror.InvalidUsername("Numeric user IDs are reserved"), }, }, - { - name: "can't register without password", - username: "helloworld", - password: "", - forceEmpty: true, - wantResponse: util.JSONResponse{ - Code: http.StatusBadRequest, - JSON: jsonerror.WeakPassword(fmt.Sprintf("password too weak: min %d chars", minPasswordLength)), - }, - }, } test.WithAllDatabases(t, func(t *testing.T, dbType test.DBType) {