Remove homeserver prop

Signed-off-by: RMidhunSuresh <rmidhunsuresh@gmail.com>
This commit is contained in:
RMidhunSuresh 2021-08-20 15:47:30 +05:30
parent dadeb7f3e5
commit 2468bc3e9f
3 changed files with 5 additions and 7 deletions

View file

@ -100,9 +100,7 @@ export class LoginViewModel extends ViewModel {
_showSSOLogin() { _showSSOLogin() {
this._startSSOLoginViewModel = this.track( this._startSSOLoginViewModel = this.track(
new StartSSOLoginViewModel( new StartSSOLoginViewModel(this.childOptions({loginOptions: this._loginOptions}))
this.childOptions({ loginOptions: this._loginOptions, homeserver: this._homeserver })
)
); );
this.emitChange("startSSOLoginViewModel"); this.emitChange("startSSOLoginViewModel");
} }

View file

@ -19,13 +19,11 @@ import {ViewModel} from "../ViewModel.js";
export class StartSSOLoginViewModel extends ViewModel{ export class StartSSOLoginViewModel extends ViewModel{
constructor(options) { constructor(options) {
super(options); super(options);
const {loginOptions, homeserver} = options; this._sso = options.loginOptions.sso;
this._sso = loginOptions.sso;
this._homeserver = homeserver;
} }
async startSSOLogin() { 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()); const link = this._sso.createSSORedirectURL(this.urlCreator.createSSOCallbackURL());
this.platform.openUrl(link); this.platform.openUrl(link);
} }

View file

@ -19,6 +19,8 @@ export class SSOLoginHelper{
this._homeserver = homeserver; this._homeserver = homeserver;
} }
get homeserver() { return this._homeserver; }
createSSORedirectURL(returnURL) { createSSORedirectURL(returnURL) {
return `${this._homeserver}/_matrix/client/r0/login/sso/redirect?redirectUrl=${returnURL}`; return `${this._homeserver}/_matrix/client/r0/login/sso/redirect?redirectUrl=${returnURL}`;
} }