rojects/electron/login.html

137 lines
3.4 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Roject — 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.6rem;
font-weight: 600;
margin-bottom: 0.25rem;
letter-spacing: -0.02em;
}
.subtitle {
font-size: 0.85rem;
color: #666;
margin-bottom: 2rem;
}
label {
display: block;
font-size: 0.78rem;
color: #888;
margin-bottom: 0.4rem;
text-transform: uppercase;
letter-spacing: 0.05em;
}
input {
width: 100%;
padding: 0.65rem 0.85rem;
background: #1a1a1a;
border: 1px solid #2a2a2a;
border-radius: 6px;
color: #e8e8e8;
font-size: 0.95rem;
outline: none;
margin-bottom: 1.2rem;
transition: border-color 0.15s;
}
input:focus { border-color: #555; }
button {
width: 100%;
padding: 0.7rem;
background: #e8e8e8;
color: #0f0f0f;
border: none;
border-radius: 6px;
font-size: 0.95rem;
font-weight: 600;
cursor: pointer;
transition: background 0.15s;
margin-top: 0.4rem;
}
button:hover { background: #fff; }
button:disabled { background: #333; color: #666; cursor: default; }
.error {
font-size: 0.83rem;
color: #e05555;
margin-top: 0.9rem;
min-height: 1.2em;
text-align: center;
}
</style>
</head>
<body>
<div class="card">
<h1>Roject</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.electronAuth.login( email, password );
if ( result.ok ) {
window.electronAuth.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>