♻️ Distinguish UserApi from UserAPI properly.

This commit is contained in:
Daniel Aloni 2023-04-30 16:01:04 +03:00
parent a27071c3e8
commit 4a2dbf41fd
4 changed files with 11 additions and 11 deletions

View file

@ -63,7 +63,7 @@ func LoginFromJSONReader(ctx context.Context, r io.Reader, useraccountAPI uapi.C
Config: cfg,
Rt: rt,
InhibitDevice: header.InhibitDevice,
UserAPI: useraccountAPI,
UserLoginAPI: useraccountAPI,
}
case authtypes.LoginTypeToken:
typ = &LoginTypeToken{

View file

@ -49,7 +49,7 @@ type LoginTypePassword struct {
Config *config.ClientAPI
Rt *ratelimit.RtFailedLogin
InhibitDevice bool
UserAPI api.UserLoginAPI
UserLoginAPI api.UserLoginAPI
}
func (t *LoginTypePassword) Name() string {
@ -194,7 +194,7 @@ func (t *LoginTypePassword) authenticateDb(ctx context.Context, localpart string
// If we couldn't find the user by the lower cased localpart, try the provided
// localpart as is.
if !res.Exists {
err = t.UserAPI.QueryAccountByPassword(ctx, &api.QueryAccountByPasswordRequest{
err = t.UserLoginAPI.QueryAccountByPassword(ctx, &api.QueryAccountByPasswordRequest{
Localpart: localpart,
ServerName: domain,
PlaintextPassword: password,
@ -312,7 +312,7 @@ func (t *LoginTypePassword) isLdapAdmin(conn *ldap.Conn, username string) (bool,
func (t *LoginTypePassword) getOrCreateAccount(ctx context.Context, localpart string, domain gomatrixserverlib.ServerName, admin bool) (*api.Account, *util.JSONResponse) {
var existing api.QueryAccountByLocalpartResponse
err := t.UserAPI.QueryAccountByLocalpart(ctx, &api.QueryAccountByLocalpartRequest{
err := t.UserLoginAPI.QueryAccountByLocalpart(ctx, &api.QueryAccountByLocalpartRequest{
Localpart: localpart,
ServerName: domain,
}, &existing)
@ -332,7 +332,7 @@ func (t *LoginTypePassword) getOrCreateAccount(ctx context.Context, localpart st
accountType = api.AccountTypeAdmin
}
var created api.PerformAccountCreationResponse
err = t.UserAPI.PerformAccountCreation(ctx, &api.PerformAccountCreationRequest{
err = t.UserLoginAPI.PerformAccountCreation(ctx, &api.PerformAccountCreationRequest{
AppServiceID: "ldap",
Localpart: localpart,
Password: uuid.New().String(),

View file

@ -115,7 +115,7 @@ type UserInteractive struct {
func NewUserInteractive(userAccountAPI api.ClientUserAPI, cfg *config.ClientAPI) *UserInteractive {
typePassword := &LoginTypePassword{
UserApi: userAccountAPI,
UserAPI: userAccountAPI,
UserLoginAPI: userAccountAPI,
Config: cfg,
}
return &UserInteractive{

View file

@ -63,7 +63,7 @@ func UploadCrossSigningDeviceKeys(
}
typePassword := auth.LoginTypePassword{
UserApi: accountAPI,
UserAPI: accountAPI,
UserLoginAPI: accountAPI,
Config: cfg,
}
if _, authErr := typePassword.Login(req.Context(), &uploadReq.Auth.PasswordRequest); authErr != nil {