Add self-hosted kids calendar app
Express + SQLite (node:sqlite, no native build step) family calendar: parent accounts with household invites, per-child calendars with save/duplicate/print, a token-gated read-only kiosk view for tablets, and polling to keep parent and kiosk views in sync. Defaults to port 3007.
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Join family — Kids Calendar</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Nunito:wght@500;700;800&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="/css/shared.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="auth-wrap">
|
||||
<h1 id="heading">Join family</h1>
|
||||
<p class="lead" id="lead">Checking your invite link…</p>
|
||||
<div class="error-msg" id="errorMsg" style="display:none;"></div>
|
||||
<form id="joinForm" style="display:none;">
|
||||
<div class="field">
|
||||
<label for="name">Your name</label>
|
||||
<input type="text" id="name" autocomplete="name" required>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="email">Email</label>
|
||||
<input type="email" id="email" autocomplete="email" required>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" autocomplete="new-password" minlength="8" required>
|
||||
</div>
|
||||
<div class="form-actions">
|
||||
<button type="submit" class="tool primary">Join</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script src="/js/api.js"></script>
|
||||
<script>
|
||||
const token = new URLSearchParams(window.location.search).get('token');
|
||||
const errorMsg = document.getElementById('errorMsg');
|
||||
const lead = document.getElementById('lead');
|
||||
const joinForm = document.getElementById('joinForm');
|
||||
|
||||
function showError(msg) {
|
||||
errorMsg.textContent = msg;
|
||||
errorMsg.style.display = 'block';
|
||||
lead.style.display = 'none';
|
||||
}
|
||||
|
||||
(async () => {
|
||||
if (!token) return showError('This link is missing an invite token.');
|
||||
try {
|
||||
const data = await api.get(`/api/invites/${encodeURIComponent(token)}`);
|
||||
lead.textContent = `You've been invited to join "${data.householdName}". Create your login below.`;
|
||||
joinForm.style.display = 'block';
|
||||
} catch (err) {
|
||||
showError(err.message);
|
||||
}
|
||||
})();
|
||||
|
||||
joinForm.addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
errorMsg.style.display = 'none';
|
||||
try {
|
||||
await api.post(`/api/invites/${encodeURIComponent(token)}/accept`, {
|
||||
name: document.getElementById('name').value,
|
||||
email: document.getElementById('email').value,
|
||||
password: document.getElementById('password').value,
|
||||
});
|
||||
window.location.href = '/dashboard.html';
|
||||
} catch (err) {
|
||||
showError(err.message);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user