1 line
1.4 KiB
HTML
1 line
1.4 KiB
HTML
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Roast Planner</title><link rel="stylesheet" href="/app.css"><meta name="theme-color" content="#A8481A"></head><body><main class="auth-page"><section class="panel-card auth-card"><h1>Roast Planner</h1><p>Build, save, and revisit your coffee roast plans.</p><div id="message" role="status"></div><form id="auth-form"><label>Email <input class="field-input" required type="email" name="email" autocomplete="email"></label><label>Password <input class="field-input" required type="password" minlength="12" name="password" autocomplete="current-password"></label><button class="primary-btn" type="submit">Log in</button><button class="ghost-btn" type="button" id="signup">Create account</button></form><p class="muted">Accounts require a password of at least 12 characters.</p></section></main><script type="module">const f=document.querySelector('#auth-form'),m=document.querySelector('#message');async function submit(url){const r=await fetch(url,{method:'POST',headers:{'content-type':'application/json'},body:JSON.stringify(Object.fromEntries(new FormData(f)))});const b=await r.json();if(!r.ok){m.textContent=b.error||b.code;return;}location='/app';}f.onsubmit=e=>{e.preventDefault();submit('/api/auth/login')};document.querySelector('#signup').onclick=()=>submit('/api/auth/signup');</script></body></html> |