Undo changes

This commit is contained in:
Till Faelligen 2019-12-21 23:18:52 +01:00
parent fee7b51d6e
commit eab5155658

View file

@ -47,9 +47,6 @@ type passwordRequest struct {
// Thus a pointer is needed to differentiate between the two // Thus a pointer is needed to differentiate between the two
InitialDisplayName *string `json:"initial_device_display_name"` InitialDisplayName *string `json:"initial_device_display_name"`
DeviceID *string `json:"device_id"` DeviceID *string `json:"device_id"`
Identifier struct {
User string `json:"user"`
} `json:"identifier"`
} }
type loginResponse struct { type loginResponse struct {
@ -82,15 +79,13 @@ func Login(
if resErr != nil { if resErr != nil {
return *resErr return *resErr
} }
if r.User == "" && r.Identifier.User == "" { if r.User == "" {
return util.JSONResponse{ return util.JSONResponse{
Code: http.StatusBadRequest, Code: http.StatusBadRequest,
JSON: jsonerror.BadJSON("'user' must be supplied."), JSON: jsonerror.BadJSON("'user' must be supplied."),
} }
} }
if r.User == "" {
r.User = r.Identifier.User
}
util.GetLogger(req.Context()).WithField("user", r.User).Info("Processing login request") util.GetLogger(req.Context()).WithField("user", r.User).Info("Processing login request")
localpart, err := userutil.ParseUsernameParam(r.User, &cfg.Matrix.ServerName) localpart, err := userutil.ParseUsernameParam(r.User, &cfg.Matrix.ServerName)