From 0e16d526c05f40c8e86274db67fc3f9bbed52615 Mon Sep 17 00:00:00 2001 From: sua yoo Date: Wed, 21 Aug 2024 15:33:24 -0700 Subject: [PATCH] fix: Hide login link on login page (#2039) - Removes log in link when on log in page - Fix e2e test, which wasn't actually logging the test user in before --- frontend/src/index.ts | 26 +++++++++++++------------- frontend/tests/login.spec.ts | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/frontend/src/index.ts b/frontend/src/index.ts index 53d25f82..dbf07c73 100644 --- a/frontend/src/index.ts +++ b/frontend/src/index.ts @@ -405,25 +405,25 @@ export class App extends LiteElement { ` - : html` - ${msg("Log In")} - ${this.appState.settings?.registrationEnabled - ? html` - - ${msg("Sign up")} - - ` - : html``} - `} + : this.renderSignUpLink()} `; } + private renderSignUpLink() { + if (!this.appState.settings) return; + + if (this.appState.settings.registrationEnabled) { + return html` + + ${msg("Sign Up")} + + `; + } + } + private renderOrgs() { const orgs = this.userInfo?.orgs; if (!orgs) return; diff --git a/frontend/tests/login.spec.ts b/frontend/tests/login.spec.ts index 14e01eff..ad20737d 100644 --- a/frontend/tests/login.spec.ts +++ b/frontend/tests/login.spec.ts @@ -20,7 +20,7 @@ test("test", async ({ baseURL }) => { ); } await page.fill('input[name="password"]', devPassword); - await page.click('a:has-text("Log In")'); + await page.click('sl-button:has-text("Log In")'); } finally { await browser.close(); }