Tweak fallback

This commit is contained in:
Neil Alexander 2022-11-18 12:25:49 +00:00
parent c059de4f2a
commit 0227613214
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -551,6 +551,7 @@ func Register(
} }
var r registerRequest var r registerRequest
r.ServerName = cfg.Matrix.ServerName
if v := cfg.Matrix.VirtualHostForHTTPHost(gomatrixserverlib.ServerName(req.Host)); v != nil { if v := cfg.Matrix.VirtualHostForHTTPHost(gomatrixserverlib.ServerName(req.Host)); v != nil {
r.ServerName = v.ServerName r.ServerName = v.ServerName
} }
@ -578,7 +579,6 @@ func Register(
if resErr := httputil.UnmarshalJSON(reqBody, &r); resErr != nil { if resErr := httputil.UnmarshalJSON(reqBody, &r); resErr != nil {
return *resErr return *resErr
} }
r.ServerName = cfg.Matrix.ServerName
if l, d, err := cfg.Matrix.SplitLocalID('@', r.Username); err == nil { if l, d, err := cfg.Matrix.SplitLocalID('@', r.Username); err == nil {
r.Username, r.ServerName = l, d r.Username, r.ServerName = l, d
} }