More tweaks
This commit is contained in:
parent
912893b70c
commit
ed915eed19
|
@ -110,7 +110,7 @@ func AdminResetPassword(req *http.Request, cfg *config.ClientAPI, device *userap
|
||||||
JSON: jsonerror.MissingArgument("Expecting user localpart."),
|
JSON: jsonerror.MissingArgument("Expecting user localpart."),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if l, s, err := gomatrixserverlib.SplitID('@', localpart); err == nil {
|
if l, s, err := cfg.Matrix.SplitLocalID('@', localpart); err == nil {
|
||||||
localpart, serverName = l, s
|
localpart, serverName = l, s
|
||||||
}
|
}
|
||||||
request := struct {
|
request := struct {
|
||||||
|
|
|
@ -1023,13 +1023,17 @@ func RegisterAvailable(
|
||||||
|
|
||||||
// Squash username to all lowercase letters
|
// Squash username to all lowercase letters
|
||||||
username = strings.ToLower(username)
|
username = strings.ToLower(username)
|
||||||
|
domain := cfg.Matrix.ServerName
|
||||||
|
if u, l, err := cfg.Matrix.SplitLocalID('@', username); err == nil {
|
||||||
|
username, domain = u, l
|
||||||
|
}
|
||||||
|
|
||||||
if err := validateUsername(username, cfg.Matrix.ServerName); err != nil {
|
if err := validateUsername(username, domain); err != nil {
|
||||||
return *err
|
return *err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this username is reserved by an application service
|
// Check if this username is reserved by an application service
|
||||||
userID := userutil.MakeUserID(username, cfg.Matrix.ServerName)
|
userID := userutil.MakeUserID(username, domain)
|
||||||
for _, appservice := range cfg.Derived.ApplicationServices {
|
for _, appservice := range cfg.Derived.ApplicationServices {
|
||||||
if appservice.OwnsNamespaceCoveringUserId(userID) {
|
if appservice.OwnsNamespaceCoveringUserId(userID) {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
|
@ -1041,7 +1045,8 @@ func RegisterAvailable(
|
||||||
|
|
||||||
res := &userapi.QueryAccountAvailabilityResponse{}
|
res := &userapi.QueryAccountAvailabilityResponse{}
|
||||||
err := registerAPI.QueryAccountAvailability(req.Context(), &userapi.QueryAccountAvailabilityRequest{
|
err := registerAPI.QueryAccountAvailability(req.Context(), &userapi.QueryAccountAvailabilityRequest{
|
||||||
Localpart: username,
|
Localpart: username,
|
||||||
|
ServerName: domain,
|
||||||
}, res)
|
}, res)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
|
|
Loading…
Reference in a new issue