mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
Fix registration in API mode
This commit is contained in:
parent
9530c60ab0
commit
22bee54c19
|
|
@ -31,6 +31,8 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/matrix-org/dendrite/internal"
|
||||
internalHTTPUtil "github.com/matrix-org/dendrite/internal/httputil"
|
||||
"github.com/matrix-org/dendrite/internal/sqlutil"
|
||||
"github.com/tidwall/gjson"
|
||||
|
||||
"github.com/matrix-org/dendrite/internal/eventutil"
|
||||
|
|
@ -859,6 +861,16 @@ func completeRegistration(
|
|||
JSON: jsonerror.UserInUse("Desired user ID is already taken."),
|
||||
}
|
||||
}
|
||||
switch e := err.(type) {
|
||||
case internalHTTPUtil.InternalAPIError:
|
||||
conflictErr := &userapi.ErrorConflict{Message: sqlutil.ErrUserExists.Error()}
|
||||
if e.Message == conflictErr.Error() {
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusBadRequest,
|
||||
JSON: jsonerror.UserInUse("Desired user ID is already taken."),
|
||||
}
|
||||
}
|
||||
}
|
||||
return util.JSONResponse{
|
||||
Code: http.StatusInternalServerError,
|
||||
JSON: jsonerror.Unknown("failed to create account: " + err.Error()),
|
||||
|
|
|
|||
Loading…
Reference in a new issue