From ca4ebeba15d7f69cbb0a7aa4c6e4a517eb423232 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 25 Jun 2025 04:21:43 +0200 Subject: [PATCH] unf auth screen --- web/src/client/components/auth-login.ts | 124 ++++-------------------- web/src/client/styles.css | 2 +- 2 files changed, 22 insertions(+), 104 deletions(-) diff --git a/web/src/client/components/auth-login.ts b/web/src/client/components/auth-login.ts index 24e82c61..41f72b53 100644 --- a/web/src/client/components/auth-login.ts +++ b/web/src/client/components/auth-login.ts @@ -2,9 +2,7 @@ import { html, LitElement } from 'lit'; import { customElement, property, state } from 'lit/decorators.js'; import type { AuthClient } from '../services/auth-client.js'; import { responsiveObserver } from '../utils/responsive-utils.js'; -import { AppSettings } from './app-settings.js'; import './terminal-icon.js'; -import './auth-quick-keys.js'; @customElement('auth-login') export class AuthLogin extends LitElement { @@ -25,27 +23,18 @@ export class AuthLogin extends LitElement { disallowUserPassword: false, noAuth: false, }; - @state() private useDirectKeyboard = false; @state() private isMobile = false; - @state() private isKeyboardFocused = false; private unsubscribeResponsive?: () => void; async connectedCallback() { super.connectedCallback(); console.log('🔌 Auth login component connected'); - // Load preferences - const preferences = AppSettings.getPreferences(); - this.useDirectKeyboard = preferences.useDirectKeyboard; - // Subscribe to responsive changes this.unsubscribeResponsive = responsiveObserver.subscribe((state) => { this.isMobile = state.isMobile; }); - // Listen for preference changes - window.addEventListener('app-preferences-changed', this.handlePreferencesChanged); - await this.loadUserInfo(); } @@ -54,14 +43,8 @@ export class AuthLogin extends LitElement { if (this.unsubscribeResponsive) { this.unsubscribeResponsive(); } - window.removeEventListener('app-preferences-changed', this.handlePreferencesChanged); } - private handlePreferencesChanged = (e: Event) => { - const event = e as CustomEvent; - this.useDirectKeyboard = event.detail.useDirectKeyboard; - }; - private async loadUserInfo() { try { // Load auth configuration first @@ -159,35 +142,6 @@ export class AuthLogin extends LitElement { this.dispatchEvent(new CustomEvent('show-ssh-key-manager')); } - private handleKeyCapture = (e: KeyboardEvent) => { - if (this.loading) return; - - e.preventDefault(); - - if (e.key === 'Enter') { - this.handlePasswordLogin(e); - } else if (e.key === 'Backspace') { - this.loginPassword = this.loginPassword.slice(0, -1); - } else if (e.key === 'Escape') { - this.loginPassword = ''; - } else if (e.key.length === 1) { - this.loginPassword += e.key; - } - }; - - private handleQuickKey = (key: string) => { - if (this.loading) return; - this.loginPassword += key; - }; - - private handleFocus = () => { - this.isKeyboardFocused = true; - }; - - private handleBlur = () => { - this.isKeyboardFocused = false; - }; - render() { console.log( '🔍 Rendering auth login', @@ -201,12 +155,12 @@ export class AuthLogin extends LitElement {
-
+
-

VibeTunnel

+

VibeTunnel

Please authenticate to continue

@@ -254,9 +208,9 @@ export class AuthLogin extends LitElement { !this.authConfig.disallowUserPassword ? html` -
-
-
+
+
+
${ this.userAvatar ? html` @@ -270,71 +224,35 @@ export class AuthLogin extends LitElement { ` : html`
- +
` }
-

+

Welcome back, ${this.currentUserId || '...'}

- ${ - this.useDirectKeyboard - ? html` - -
- - ${ - this.loginPassword - ? '•'.repeat(this.loginPassword.length) - : this.isKeyboardFocused - ? 'Type your password...' - : 'Click to enter password' - } - -
- ${ - this.isMobile - ? html` -
- -
- ` - : '' - } - ` - : html` - - { - this.loginPassword = (e.target as HTMLInputElement).value; - }} - ?disabled=${this.loading} - required - /> - ` - } + { + this.loginPassword = (e.target as HTMLInputElement).value; + }} + ?disabled=${this.loading} + required + />