diff --git a/src/domain/LoginViewModel.js b/src/domain/LoginViewModel.js index 1b52e1a5..9e1db503 100644 --- a/src/domain/LoginViewModel.js +++ b/src/domain/LoginViewModel.js @@ -49,6 +49,7 @@ export class LoginViewModel extends ViewModel { this._loadViewModel = this.track(new SessionLoadViewModel(this.childOptions({ createAndStartSessionContainer: () => { this._sessionContainer = this._createSessionContainer(); + this._sessionContainer.queryLogin(homeserver); this._sessionContainer.startWithLogin(homeserver, username, password); return this._sessionContainer; }, diff --git a/src/matrix/SessionContainer.js b/src/matrix/SessionContainer.js index 07c4a870..1106644c 100644 --- a/src/matrix/SessionContainer.js +++ b/src/matrix/SessionContainer.js @@ -97,6 +97,12 @@ export class SessionContainer { }); } + async queryLogin(homeServer) { + homeServer = normalizeHomeserver(homeServer); + const hsApi = new HomeServerApi({homeServer, request: this._platform.request}); + const response = hsApi.queryLogin(); + } + async startWithLogin(homeServer, username, password) { if (this._status.get() !== LoadStatus.NotLoading) { return; diff --git a/src/matrix/net/HomeServerApi.js b/src/matrix/net/HomeServerApi.js index a9b63f8e..6dec6bd6 100644 --- a/src/matrix/net/HomeServerApi.js +++ b/src/matrix/net/HomeServerApi.js @@ -134,6 +134,10 @@ export class HomeServerApi { return this._get(`/rooms/${encodeURIComponent(roomId)}/state/${encodeURIComponent(eventType)}/${encodeURIComponent(stateKey)}`, {}, null, options); } + queryLogin() { + return this._unauthedRequest("GET", this._url("/login"), null, null, null); + } + passwordLogin(username, password, initialDeviceDisplayName, options = null) { return this._unauthedRequest("POST", this._url("/login"), null, { "type": "m.login.password",