From 7ac1efc4b3bdd7921e8182c575d4be48e062c8b4 Mon Sep 17 00:00:00 2001 From: Anant Prakash Date: Thu, 31 May 2018 15:16:50 +0530 Subject: [PATCH] Scan AppServiceID from accounts table, fix typo (#474) --- .../clientapi/auth/storage/accounts/accounts_table.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/accounts/accounts_table.go b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/accounts/accounts_table.go index a29d616e..8ea2d517 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/auth/storage/accounts/accounts_table.go +++ b/src/github.com/matrix-org/dendrite/clientapi/auth/storage/accounts/accounts_table.go @@ -44,7 +44,7 @@ const insertAccountSQL = "" + "INSERT INTO account_accounts(localpart, created_ts, password_hash, appservice_id) VALUES ($1, $2, $3, $4)" const selectAccountByLocalpartSQL = "" + - "SELECT localpart FROM account_accounts WHERE localpart = $1" + "SELECT localpart, appservice_id FROM account_accounts WHERE localpart = $1" const selectPasswordHashSQL = "" + "SELECT password_hash FROM account_accounts WHERE localpart = $1" @@ -112,15 +112,14 @@ func (s *accountsStatements) selectPasswordHash( func (s *accountsStatements) selectAccountByLocalpart( ctx context.Context, localpart string, -) (*authtypes.Account, error) { - var acc authtypes.Account +) (acc *authtypes.Account, err error) { stmt := s.selectAccountByLocalpartStmt - err := stmt.QueryRowContext(ctx, localpart).Scan(&acc.Localpart) - if err != nil { + err = stmt.QueryRowContext(ctx, localpart).Scan(&acc.Localpart, &acc.AppServiceID) + if err == nil { acc.UserID = makeUserID(localpart, s.serverName) acc.ServerName = s.serverName } - return &acc, err + return } func makeUserID(localpart string, server gomatrixserverlib.ServerName) string {