mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 15:03:09 -06:00
♻️ Distinguish UserApi from UserAPI properly.
This commit is contained in:
parent
a27071c3e8
commit
4a2dbf41fd
|
|
@ -63,7 +63,7 @@ func LoginFromJSONReader(ctx context.Context, r io.Reader, useraccountAPI uapi.C
|
||||||
Config: cfg,
|
Config: cfg,
|
||||||
Rt: rt,
|
Rt: rt,
|
||||||
InhibitDevice: header.InhibitDevice,
|
InhibitDevice: header.InhibitDevice,
|
||||||
UserAPI: useraccountAPI,
|
UserLoginAPI: useraccountAPI,
|
||||||
}
|
}
|
||||||
case authtypes.LoginTypeToken:
|
case authtypes.LoginTypeToken:
|
||||||
typ = &LoginTypeToken{
|
typ = &LoginTypeToken{
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ type LoginTypePassword struct {
|
||||||
Config *config.ClientAPI
|
Config *config.ClientAPI
|
||||||
Rt *ratelimit.RtFailedLogin
|
Rt *ratelimit.RtFailedLogin
|
||||||
InhibitDevice bool
|
InhibitDevice bool
|
||||||
UserAPI api.UserLoginAPI
|
UserLoginAPI api.UserLoginAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *LoginTypePassword) Name() string {
|
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
|
// If we couldn't find the user by the lower cased localpart, try the provided
|
||||||
// localpart as is.
|
// localpart as is.
|
||||||
if !res.Exists {
|
if !res.Exists {
|
||||||
err = t.UserAPI.QueryAccountByPassword(ctx, &api.QueryAccountByPasswordRequest{
|
err = t.UserLoginAPI.QueryAccountByPassword(ctx, &api.QueryAccountByPasswordRequest{
|
||||||
Localpart: localpart,
|
Localpart: localpart,
|
||||||
ServerName: domain,
|
ServerName: domain,
|
||||||
PlaintextPassword: password,
|
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) {
|
func (t *LoginTypePassword) getOrCreateAccount(ctx context.Context, localpart string, domain gomatrixserverlib.ServerName, admin bool) (*api.Account, *util.JSONResponse) {
|
||||||
var existing api.QueryAccountByLocalpartResponse
|
var existing api.QueryAccountByLocalpartResponse
|
||||||
err := t.UserAPI.QueryAccountByLocalpart(ctx, &api.QueryAccountByLocalpartRequest{
|
err := t.UserLoginAPI.QueryAccountByLocalpart(ctx, &api.QueryAccountByLocalpartRequest{
|
||||||
Localpart: localpart,
|
Localpart: localpart,
|
||||||
ServerName: domain,
|
ServerName: domain,
|
||||||
}, &existing)
|
}, &existing)
|
||||||
|
|
@ -332,7 +332,7 @@ func (t *LoginTypePassword) getOrCreateAccount(ctx context.Context, localpart st
|
||||||
accountType = api.AccountTypeAdmin
|
accountType = api.AccountTypeAdmin
|
||||||
}
|
}
|
||||||
var created api.PerformAccountCreationResponse
|
var created api.PerformAccountCreationResponse
|
||||||
err = t.UserAPI.PerformAccountCreation(ctx, &api.PerformAccountCreationRequest{
|
err = t.UserLoginAPI.PerformAccountCreation(ctx, &api.PerformAccountCreationRequest{
|
||||||
AppServiceID: "ldap",
|
AppServiceID: "ldap",
|
||||||
Localpart: localpart,
|
Localpart: localpart,
|
||||||
Password: uuid.New().String(),
|
Password: uuid.New().String(),
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,7 @@ type UserInteractive struct {
|
||||||
func NewUserInteractive(userAccountAPI api.ClientUserAPI, cfg *config.ClientAPI) *UserInteractive {
|
func NewUserInteractive(userAccountAPI api.ClientUserAPI, cfg *config.ClientAPI) *UserInteractive {
|
||||||
typePassword := &LoginTypePassword{
|
typePassword := &LoginTypePassword{
|
||||||
UserApi: userAccountAPI,
|
UserApi: userAccountAPI,
|
||||||
UserAPI: userAccountAPI,
|
UserLoginAPI: userAccountAPI,
|
||||||
Config: cfg,
|
Config: cfg,
|
||||||
}
|
}
|
||||||
return &UserInteractive{
|
return &UserInteractive{
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ func UploadCrossSigningDeviceKeys(
|
||||||
}
|
}
|
||||||
typePassword := auth.LoginTypePassword{
|
typePassword := auth.LoginTypePassword{
|
||||||
UserApi: accountAPI,
|
UserApi: accountAPI,
|
||||||
UserAPI: accountAPI,
|
UserLoginAPI: accountAPI,
|
||||||
Config: cfg,
|
Config: cfg,
|
||||||
}
|
}
|
||||||
if _, authErr := typePassword.Login(req.Context(), &uploadReq.Auth.PasswordRequest); authErr != nil {
|
if _, authErr := typePassword.Login(req.Context(), &uploadReq.Auth.PasswordRequest); authErr != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue