UNPKG

@interopio/desktop-cli

Version:

CLI tool for setting up, building and packaging io.Connect Desktop projects

239 lines (207 loc) 7.72 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>{{PRODUCT_NAME}} - Login</title> <style> body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: #333; display: flex; align-items: center; justify-content: center; height: 100vh; overflow: hidden; -webkit-app-region: drag; } .login-container { background: white; border-radius: 12px; padding: 40px; width: 300px; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1); -webkit-app-region: no-drag; } .logo { width: 60px; height: 60px; margin: 0 auto 20px; display: block; color: #667eea; } .title { text-align: center; font-size: 24px; font-weight: 300; margin-bottom: 8px; color: #333; } .subtitle { text-align: center; font-size: 14px; color: #666; margin-bottom: 30px; } .form-group { margin-bottom: 20px; } .form-group label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; color: #555; } .form-group input { width: 100%; padding: 12px; border: 2px solid #e1e5e9; border-radius: 6px; font-size: 16px; transition: border-color 0.3s; box-sizing: border-box; } .form-group input:focus { outline: none; border-color: #667eea; } .login-button { width: 100%; padding: 14px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; border: none; border-radius: 6px; font-size: 16px; font-weight: 500; cursor: pointer; transition: opacity 0.3s; margin-top: 10px; } .login-button:hover { opacity: 0.9; } .login-button:disabled { opacity: 0.6; cursor: not-allowed; } .error-message { color: #dc3545; font-size: 14px; margin-top: 10px; text-align: center; display: none; } .close-button { position: absolute; top: 10px; right: 15px; background: none; border: none; font-size: 20px; color: rgba(255, 255, 255, 0.7); cursor: pointer; -webkit-app-region: no-drag; } .close-button:hover { color: white; } </style> </head> <body> <button class="close-button" onclick="closeLogin()">&times;</button> <div class="login-container"> <div class="logo"> <svg viewBox="0 0 60 60" fill="currentColor"> <circle cx="30" cy="30" r="28" fill="none" stroke="currentColor" stroke-width="2"/> <circle cx="30" cy="30" r="5" fill="currentColor"/> <circle cx="18" cy="18" r="4" fill="currentColor"/> <circle cx="42" cy="18" r="4" fill="currentColor"/> <circle cx="18" cy="42" r="4" fill="currentColor"/> <circle cx="42" cy="42" r="4" fill="currentColor"/> <line x1="30" y1="25" x2="22" y2="22" stroke="currentColor" stroke-width="2"/> <line x1="30" y1="25" x2="38" y2="22" stroke="currentColor" stroke-width="2"/> <line x1="30" y1="35" x2="22" y2="38" stroke="currentColor" stroke-width="2"/> <line x1="30" y1="35" x2="38" y2="38" stroke="currentColor" stroke-width="2"/> </svg> </div> <h1 class="title">{{PRODUCT_NAME}}</h1> <p class="subtitle">Sign in to continue</p> <form id="loginForm"> <div class="form-group"> <label for="username">Username</label> <input type="text" id="username" name="username" required> </div> <div class="form-group"> <label for="password">Password</label> <input type="password" id="password" name="password" required> </div> <button type="submit" class="login-button" id="loginButton"> Sign In </button> <div class="error-message" id="errorMessage"></div> </form> </div> <script> const form = document.getElementById('loginForm'); const errorMessage = document.getElementById('errorMessage'); const loginButton = document.getElementById('loginButton'); form.addEventListener('submit', async (e) => { e.preventDefault(); const username = document.getElementById('username').value; const password = document.getElementById('password').value; if (!username || !password) { showError('Please enter both username and password'); return; } loginButton.disabled = true; loginButton.textContent = 'Signing in...'; try { // Simulate authentication - replace with actual auth logic const success = await authenticate(username, password); if (success) { if (window.loginAPI) { window.loginAPI.success({ username }); } } else { showError('Invalid username or password'); } } catch (error) { showError('Login failed. Please try again.'); } finally { loginButton.disabled = false; loginButton.textContent = 'Sign In'; } }); function showError(message) { errorMessage.textContent = message; errorMessage.style.display = 'block'; setTimeout(() => { errorMessage.style.display = 'none'; }, 5000); } async function authenticate(username, password) { // Simulate API call return new Promise((resolve) => { setTimeout(() => { // Demo: accept any non-empty credentials resolve(username && password); }, 1000); }); } function closeLogin() { if (window.loginAPI) { window.loginAPI.cancel(); } } // Focus username field on load document.addEventListener('DOMContentLoaded', () => { document.getElementById('username').focus(); }); </script> </body> </html>