From dea9fd90b490be50a2444c707a976b1c3138445e Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Tue, 8 Sep 2020 10:53:15 +0200 Subject: [PATCH] name devices at login "Hydrogen" so you can somewhat identify them in a device list --- src/matrix/SessionContainer.js | 2 +- src/matrix/net/HomeServerApi.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/matrix/SessionContainer.js b/src/matrix/SessionContainer.js index 7917baf4..9b64115f 100644 --- a/src/matrix/SessionContainer.js +++ b/src/matrix/SessionContainer.js @@ -89,7 +89,7 @@ export class SessionContainer { let sessionInfo; try { const hsApi = new HomeServerApi({homeServer, request: this._request, createTimeout: this._clock.createTimeout}); - const loginData = await hsApi.passwordLogin(username, password).response(); + const loginData = await hsApi.passwordLogin(username, password, "Hydrogen").response(); const sessionId = this.createNewSessionId(); sessionInfo = { id: sessionId, diff --git a/src/matrix/net/HomeServerApi.js b/src/matrix/net/HomeServerApi.js index b1a89634..649a7462 100644 --- a/src/matrix/net/HomeServerApi.js +++ b/src/matrix/net/HomeServerApi.js @@ -141,14 +141,15 @@ export class HomeServerApi { {}, {}, options); } - passwordLogin(username, password, options = null) { + passwordLogin(username, password, initialDeviceDisplayName, options = null) { return this._post("/login", null, { "type": "m.login.password", "identifier": { "type": "m.id.user", "user": username }, - "password": password + "password": password, + "initial_device_display_name": initialDeviceDisplayName }, options); }