diff --git a/src/domain/login/CompleteSSOLoginViewModel.js b/src/domain/login/CompleteSSOLoginViewModel.js index 2ec2f371..1fed0b41 100644 --- a/src/domain/login/CompleteSSOLoginViewModel.js +++ b/src/domain/login/CompleteSSOLoginViewModel.js @@ -59,7 +59,6 @@ export class CompleteSSOLoginViewModel extends ViewModel { } if (error) { this._showError(error); - this._sessionContainer.resetStatus(); } } } diff --git a/src/domain/login/LoginViewModel.js b/src/domain/login/LoginViewModel.js index 78457be0..9e8ed146 100644 --- a/src/domain/login/LoginViewModel.js +++ b/src/domain/login/LoginViewModel.js @@ -89,7 +89,6 @@ export class LoginViewModel extends ViewModel { _showPasswordLogin() { this._passwordLoginViewModel = this.track(new PasswordLoginViewModel( this.childOptions({ - sessionContainer: this._sessionContainer, loginOptions: this._loginOptions, homeserver: this._homeserver, attemptLogin: loginMethod => this.attemptLogin(loginMethod), diff --git a/src/domain/login/PasswordLoginViewModel.js b/src/domain/login/PasswordLoginViewModel.js index d08b8312..76814806 100644 --- a/src/domain/login/PasswordLoginViewModel.js +++ b/src/domain/login/PasswordLoginViewModel.js @@ -20,8 +20,7 @@ import {LoginFailure} from "../../matrix/SessionContainer.js"; export class PasswordLoginViewModel extends ViewModel { constructor(options) { super(options); - const {loginOptions, sessionContainer, homeserver, attemptLogin, showError} = options; - this._sessionContainer = sessionContainer; + const {loginOptions, homeserver, attemptLogin, showError} = options; this._loginOptions = loginOptions; this._attemptLogin = attemptLogin; this._showError = showError; @@ -54,7 +53,6 @@ export class PasswordLoginViewModel extends ViewModel { } if (error) { this._showError(error); - this._sessionContainer.resetStatus(); } } } diff --git a/src/matrix/SessionContainer.js b/src/matrix/SessionContainer.js index c078f95f..ca8379bc 100644 --- a/src/matrix/SessionContainer.js +++ b/src/matrix/SessionContainer.js @@ -129,9 +129,11 @@ export class SessionContainer { } async startWithLogin(loginMethod) { - if (this._status.get() !== LoadStatus.NotLoading) { + const currentStatus = this._status.get(); + if (currentStatus !== LoadStatus.LoginFailed && currentStatus !== LoadStatus.NotLoading) { return; } + this._resetStatus(); await this._platform.logger.run("login", async log => { this._status.set(LoadStatus.Login); const clock = this._platform.clock; @@ -354,7 +356,7 @@ export class SessionContainer { } } - resetStatus() { + _resetStatus() { this._status.set(LoadStatus.NotLoading); this._error = null; this._loginFailure = null;