tunnel/electron-agent/login.html

132 lines
3.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tunnel Agent — Sign in</title>
<style>
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
background: #0f0f0f;
color: #e8e8e8;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
user-select: none;
}
.card { width: 340px; padding: 2.5rem 2rem; }
h1 {
font-size: 1.4rem;
font-weight: 600;
margin-bottom: 0.2rem;
letter-spacing: -0.02em;
}
.subtitle { font-size: 0.83rem; color: #666; margin-bottom: 2rem; }
label {
display: block;
font-size: 0.75rem;
color: #888;
margin-bottom: 0.35rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
input {
width: 100%;
padding: 0.6rem 0.8rem;
background: #1a1a1a;
border: 1px solid #2a2a2a;
border-radius: 6px;
color: #e8e8e8;
font-size: 0.92rem;
outline: none;
margin-bottom: 1.1rem;
transition: border-color 0.15s;
}
input:focus { border-color: #555; }
button {
width: 100%;
padding: 0.68rem;
background: #e8e8e8;
color: #0f0f0f;
border: none;
border-radius: 6px;
font-size: 0.92rem;
font-weight: 600;
cursor: pointer;
transition: background 0.15s;
margin-top: 0.3rem;
}
button:hover { background: #fff; }
button:disabled { background: #333; color: #666; cursor: default; }
.error {
font-size: 0.8rem;
color: #e05555;
margin-top: 0.8rem;
min-height: 1.1em;
text-align: center;
}
</style>
</head>
<body>
<div class="card">
<h1>Tunnel Agent</h1>
<p class="subtitle">Sign in with your rokojori account</p>
<label for="email">Email</label>
<input id="email" type="email" placeholder="you@example.com" autocomplete="email">
<label for="password">Password</label>
<input id="password" type="password" placeholder="••••••••" autocomplete="current-password">
<button id="btn">Sign in</button>
<p class="error" id="error"></p>
</div>
<script>
const emailEl = document.getElementById( 'email' );
const passwordEl = document.getElementById( 'password' );
const btn = document.getElementById( 'btn' );
const errorEl = document.getElementById( 'error' );
async function login()
{
const email = emailEl.value.trim();
const password = passwordEl.value;
if ( !email || !password ) { errorEl.textContent = 'Please enter email and password.'; return; }
btn.disabled = true;
btn.textContent = 'Signing in…';
errorEl.textContent = '';
const result = await window.tunnelAPI.login( email, password );
if ( result.ok )
{
window.tunnelAPI.loginSuccess();
}
else
{
errorEl.textContent = result.error ?? 'Sign in failed.';
btn.disabled = false;
btn.textContent = 'Sign in';
}
}
btn.addEventListener( 'click', login );
document.addEventListener( 'keydown', e => { if ( e.key === 'Enter' ) login(); } );
emailEl.focus();
</script>
</body>
</html>