mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-01 03:03:10 -06:00
Move accountType to completeRegistration
This commit is contained in:
parent
7d2930620b
commit
849fc301e6
|
|
@ -702,7 +702,7 @@ func handleApplicationServiceRegistration(
|
|||
// application service registration is entirely separate.
|
||||
return completeRegistration(
|
||||
req.Context(), userAPI, r.Username, "", appserviceID, req.RemoteAddr, req.UserAgent(),
|
||||
r.InhibitLogin, r.InitialDisplayName, r.DeviceID,
|
||||
r.InhibitLogin, r.InitialDisplayName, r.DeviceID, userapi.AccountTypeAppService,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -721,7 +721,7 @@ func checkAndCompleteFlow(
|
|||
// This flow was completed, registration can continue
|
||||
return completeRegistration(
|
||||
req.Context(), userAPI, r.Username, r.Password, "", req.RemoteAddr, req.UserAgent(),
|
||||
r.InhibitLogin, r.InitialDisplayName, r.DeviceID,
|
||||
r.InhibitLogin, r.InitialDisplayName, r.DeviceID, userapi.AccountTypeUser,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -746,6 +746,7 @@ func completeRegistration(
|
|||
username, password, appserviceID, ipAddr, userAgent string,
|
||||
inhibitLogin eventutil.WeakBoolean,
|
||||
displayName, deviceID *string,
|
||||
accType userapi.AccountType,
|
||||
) util.JSONResponse {
|
||||
if username == "" {
|
||||
return util.JSONResponse{
|
||||
|
|
@ -760,10 +761,6 @@ func completeRegistration(
|
|||
JSON: jsonerror.BadJSON("missing password"),
|
||||
}
|
||||
}
|
||||
accType := userapi.AccountTypeUser
|
||||
if appserviceID != "" {
|
||||
accType = userapi.AccountTypeAppService
|
||||
}
|
||||
var accRes userapi.PerformAccountCreationResponse
|
||||
err := userAPI.PerformAccountCreation(ctx, &userapi.PerformAccountCreationRequest{
|
||||
AppServiceID: appserviceID,
|
||||
|
|
@ -967,5 +964,10 @@ func handleSharedSecretRegistration(userAPI userapi.UserInternalAPI, sr *SharedS
|
|||
return *resErr
|
||||
}
|
||||
deviceID := "shared_secret_registration"
|
||||
return completeRegistration(req.Context(), userAPI, ssrr.User, ssrr.Password, "", req.RemoteAddr, req.UserAgent(), false, &ssrr.User, &deviceID)
|
||||
|
||||
accType := userapi.AccountTypeUser
|
||||
if ssrr.Admin {
|
||||
accType = userapi.AccountTypeAdmin
|
||||
}
|
||||
return completeRegistration(req.Context(), userAPI, ssrr.User, ssrr.Password, "", req.RemoteAddr, req.UserAgent(), false, &ssrr.User, &deviceID, accType)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue