Make userapi control account creation entirely (#1139)

This makes a chokepoint with which we can finally fix
'database is locked' errors on sqlite during account creation
This commit is contained in:
Kegsay 2020-06-17 11:22:26 +01:00 committed by GitHub
parent 04c99092a4
commit a66a3b830c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 131 additions and 113 deletions

View file

@ -20,7 +20,6 @@ import (
"context"
"github.com/matrix-org/dendrite/clientapi/auth"
"github.com/matrix-org/dendrite/clientapi/auth/authtypes"
"github.com/matrix-org/dendrite/clientapi/auth/storage/accounts"
"github.com/matrix-org/dendrite/clientapi/auth/storage/devices"
"github.com/matrix-org/dendrite/clientapi/httputil"
@ -81,7 +80,7 @@ func Login(
}
} else if req.Method == http.MethodPost {
var r passwordRequest
var acc *authtypes.Account
var acc *api.Account
resErr := httputil.UnmarshalJSONRequest(req, &r)
if resErr != nil {
return *resErr
@ -156,7 +155,7 @@ func getDevice(
ctx context.Context,
r passwordRequest,
deviceDB devices.Database,
acc *authtypes.Account,
acc *api.Account,
token string,
) (dev *api.Device, err error) {
dev, err = deviceDB.CreateDevice(