diff --git a/src/domain/login/LoginViewModel.js b/src/domain/login/LoginViewModel.js index b080c76e..27e45d1f 100644 --- a/src/domain/login/LoginViewModel.js +++ b/src/domain/login/LoginViewModel.js @@ -49,11 +49,15 @@ export class LoginViewModel extends ViewModel { get homeserver() { return this._homeserver; } get errorMessage() { return this._errorMessage; } get showHomeserver() { return !this._hideHomeserver; } - get cancelUrl() { return this.urlCreator.urlForSegment("session"); } get loadViewModel() {return this._loadViewModel; } get isBusy() { return this._isBusy; } get isFetchingLoginOptions() { return this._isFetchingLoginOptions; } + goBack() { + const path = this.navigation.pathFrom([this.navigation.segment("session")]); + this.navigation.applyPath(path); + } + async _createViewModels(homeserver) { if (this._loginToken) { this._hideHomeserver = true; diff --git a/src/platform/web/ui/login/LoginView.js b/src/platform/web/ui/login/LoginView.js index 4b507567..3d8e8470 100644 --- a/src/platform/web/ui/login/LoginView.js +++ b/src/platform/web/ui/login/LoginView.js @@ -23,8 +23,14 @@ import {spinner} from "../common.js"; export class LoginView extends TemplateView { render(t, vm) { + const disabled = vm => vm.isBusy; + return t.div({className: "PreSessionScreen"}, [ - t.a({className: "button-utility LoginView_back", href: vm.cancelUrl}), + t.button({ + className: "button-utility LoginView_back", + onClick: () => vm.goBack(), + disabled + }), t.div({className: "logo"}), t.h1([vm.i18n`Sign In`]), t.mapView(vm => vm.completeSSOLoginViewModel, vm => vm ? new CompleteSSOView(vm) : null), @@ -37,7 +43,7 @@ export class LoginView extends TemplateView { type: "text", placeholder: vm.i18n`Your matrix homeserver`, value: vm.homeserver, - disabled: vm => vm.isBusy, + disabled, onChange: event => vm.updateHomeServer(event.target.value), }) ]