From f3946fcdf37b2470871ffdcc569f34ececa71527 Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Mon, 2 Aug 2021 15:30:21 +0530 Subject: [PATCH] Pass log as argument Signed-off-by: RMidhunSuresh --- src/matrix/SessionContainer.js | 2 +- src/matrix/login/LoginMethod.js | 5 ++--- src/matrix/login/PasswordLoginMethod.js | 6 ++---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/matrix/SessionContainer.js b/src/matrix/SessionContainer.js index 4b112080..85aa979c 100644 --- a/src/matrix/SessionContainer.js +++ b/src/matrix/SessionContainer.js @@ -106,7 +106,7 @@ export class SessionContainer { const result = {}; for (const flow of flows) { if (flow.type === "m.login.password") { - result.password = (username, password) => new PasswordLoginMethod({homeServer, username, password, platform: this._platform}); + result.password = (username, password) => new PasswordLoginMethod({homeServer, username, password}); } } return result; diff --git a/src/matrix/login/LoginMethod.js b/src/matrix/login/LoginMethod.js index 2dbab85e..fee8e845 100644 --- a/src/matrix/login/LoginMethod.js +++ b/src/matrix/login/LoginMethod.js @@ -15,13 +15,12 @@ limitations under the License. */ export class LoginMethod { - constructor({homeServer, platform}) { + constructor({homeServer}) { this.homeServer = homeServer; - this._platform = platform; } // eslint-disable-next-line no-unused-vars - async login(hsApi, deviceName) { + async login(hsApi, deviceName, log) { /* Regardless of the login method, SessionContainer.startWithLogin() can do SomeLoginMethod.login() diff --git a/src/matrix/login/PasswordLoginMethod.js b/src/matrix/login/PasswordLoginMethod.js index abe9c23d..5c90ccf8 100644 --- a/src/matrix/login/PasswordLoginMethod.js +++ b/src/matrix/login/PasswordLoginMethod.js @@ -23,9 +23,7 @@ export class PasswordLoginMethod extends LoginMethod { this.password = options.password; } - async login(hsApi, deviceName) { - return this._platform.logger.run("passwordLogin", async log => - await hsApi.passwordLogin(this.username, this.password, deviceName, {log}).response() - ); + async login(hsApi, deviceName, log) { + return await hsApi.passwordLogin(this.username, this.password, deviceName, {log}).response(); } }