diff --git a/src/domain/login/LoginViewModel.js b/src/domain/login/LoginViewModel.js index df779ec0..78457be0 100644 --- a/src/domain/login/LoginViewModel.js +++ b/src/domain/login/LoginViewModel.js @@ -100,9 +100,7 @@ export class LoginViewModel extends ViewModel { _showSSOLogin() { this._startSSOLoginViewModel = this.track( - new StartSSOLoginViewModel( - this.childOptions({ loginOptions: this._loginOptions, homeserver: this._homeserver }) - ) + new StartSSOLoginViewModel(this.childOptions({loginOptions: this._loginOptions})) ); this.emitChange("startSSOLoginViewModel"); } diff --git a/src/domain/login/StartSSOLoginViewModel.js b/src/domain/login/StartSSOLoginViewModel.js index 9a54d2c4..41f6dbeb 100644 --- a/src/domain/login/StartSSOLoginViewModel.js +++ b/src/domain/login/StartSSOLoginViewModel.js @@ -19,13 +19,11 @@ import {ViewModel} from "../ViewModel.js"; export class StartSSOLoginViewModel extends ViewModel{ constructor(options) { super(options); - const {loginOptions, homeserver} = options; - this._sso = loginOptions.sso; - this._homeserver = homeserver; + this._sso = options.loginOptions.sso; } async startSSOLogin() { - await this.platform.settingsStorage.setString("sso_ongoing_login_homeserver", this._homeserver); + await this.platform.settingsStorage.setString("sso_ongoing_login_homeserver", this._sso.homeserver); const link = this._sso.createSSORedirectURL(this.urlCreator.createSSOCallbackURL()); this.platform.openUrl(link); } diff --git a/src/matrix/login/SSOLoginHelper.js b/src/matrix/login/SSOLoginHelper.js index 376e81ba..a15c8ef9 100644 --- a/src/matrix/login/SSOLoginHelper.js +++ b/src/matrix/login/SSOLoginHelper.js @@ -19,6 +19,8 @@ export class SSOLoginHelper{ this._homeserver = homeserver; } + get homeserver() { return this._homeserver; } + createSSORedirectURL(returnURL) { return `${this._homeserver}/_matrix/client/r0/login/sso/redirect?redirectUrl=${returnURL}`; }