From daf7af17b10200b5651682ad0a383737c2d9e78f Mon Sep 17 00:00:00 2001 From: RMidhunSuresh Date: Thu, 19 Aug 2021 20:35:07 +0530 Subject: [PATCH] Move logic to vm Signed-off-by: RMidhunSuresh --- src/domain/login/LoginViewModel.js | 1 + src/platform/web/ui/login/LoginView.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/domain/login/LoginViewModel.js b/src/domain/login/LoginViewModel.js index 76876a9b..73547957 100644 --- a/src/domain/login/LoginViewModel.js +++ b/src/domain/login/LoginViewModel.js @@ -41,6 +41,7 @@ export class LoginViewModel extends ViewModel { get completeSSOLoginViewModel(){ return this._completeSSOLoginViewModel; } get defaultHomeServer() { return this._homeserver; } get errorMessage() { return this._errorMessage; } + get showHomeserver() { return !this._completeSSOLoginViewModel; } async _createViewModels(homeserver) { if (this._loginToken) { diff --git a/src/platform/web/ui/login/LoginView.js b/src/platform/web/ui/login/LoginView.js index f260314d..ebcac433 100644 --- a/src/platform/web/ui/login/LoginView.js +++ b/src/platform/web/ui/login/LoginView.js @@ -33,7 +33,7 @@ export class LoginView extends TemplateView { t.div({className: "logo"}), t.h1([vm.i18n`Sign In`]), t.mapView(vm => vm.completeSSOLoginViewModel, vm => vm ? new CompleteSSOView(vm) : null), - t.if(vm => !vm.completeSSOLoginViewModel, + t.if(vm => vm.showHomeserver, (t, vm) => t.div({ className: "LoginView_sso form form-row" }, [t.label({ for: "homeserver" }, vm.i18n`Homeserver`), homeserver])), t.mapView(vm => vm.passwordLoginViewModel, vm => vm ? new PasswordLoginView(vm): null), t.if(vm => vm.passwordLoginViewModel && vm.startSSOLoginViewModel, t => t.p({className: "LoginView_separator"}, vm.i18n`or`)),