mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-08 23:43:11 -06:00
Re-add the ID field
This commit is contained in:
parent
12b0398f2b
commit
b29725ab13
|
|
@ -16,6 +16,7 @@ package authtypes
|
|||
|
||||
// Device represents a client's device (mobile, web, etc)
|
||||
type Device struct {
|
||||
ID string
|
||||
UserID string
|
||||
// The access_token granted to this device.
|
||||
// This uniquely identifies the device from all other devices and clients.
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ func (s *devicesStatements) insertDevice(txn *sql.Tx, id, localpart, accessToken
|
|||
createdTimeMS := time.Now().UnixNano() / 1000000
|
||||
if _, err = s.insertDeviceStmt.Exec(id, localpart, accessToken, createdTimeMS); err == nil {
|
||||
dev = &authtypes.Device{
|
||||
ID: id,
|
||||
UserID: makeUserID(localpart, s.serverName),
|
||||
AccessToken: accessToken,
|
||||
}
|
||||
|
|
@ -103,7 +104,7 @@ func (s *devicesStatements) deleteDevice(txn *sql.Tx, id, localpart string) erro
|
|||
func (s *devicesStatements) selectDeviceByToken(accessToken string) (*authtypes.Device, error) {
|
||||
var dev authtypes.Device
|
||||
var localpart string
|
||||
err := s.selectDeviceByTokenStmt.QueryRow(accessToken).Scan(&localpart)
|
||||
err := s.selectDeviceByTokenStmt.QueryRow(accessToken).Scan(&dev.ID, &localpart)
|
||||
if err != nil {
|
||||
dev.UserID = makeUserID(localpart, s.serverName)
|
||||
dev.AccessToken = accessToken
|
||||
|
|
|
|||
Loading…
Reference in a new issue