From e59ba4d05a8359065f6c1f6dd774345c00b5fc48 Mon Sep 17 00:00:00 2001 From: Inferencebot Date: Sun, 8 Nov 2026 02:57:30 +0000 Subject: [PATCH] Guest-invite form: keep a name field, optional and clearly labelled Same standard form as the admin panel: the guest's email (required) plus an OPTIONAL display name ('Their name (optional)' placeholder). Passed through as the initial display name; an empty name is never derived from the email. Full-width inputs in the stacked mobile form. --- app/main.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/main.py b/app/main.py index 144e317..d592e2c 100644 --- a/app/main.py +++ b/app/main.py @@ -630,9 +630,11 @@ PAGE_HTML = """ /* ---------- Guest access (members inviting a friend) ---------- */ .guest-hint { color: var(--muted); font-size: 12px; margin-bottom: 12px; } - /* Standard guest-invite form (shared with the admin panel): ONE field. */ + /* Standard guest-invite form (shared with the admin panel): email required, + name optional. */ .guest-invite-title { font-size: 14px; font-weight: 700; margin: 0 0 8px; } .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; } + .new-key .name-input { max-width: 200px; } .guest-trail { margin-top: 6px; } .guest-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; @@ -670,6 +672,7 @@ PAGE_HTML = """ .key-token { max-width: 100%; } .new-key { flex-direction: column; } .new-key button { width: 100%; } + .new-key .name-input { max-width: none; } /* full-width in the stacked form */ .key-reveal-value { font-size: 11px; } footer { padding: 16px 14px; } footer a { display: inline-block; margin: 4px 8px; } @@ -849,6 +852,8 @@ PAGE_HTML = """
+ +
@@ -1021,13 +1026,15 @@ function renderGuests(d) { }).join(''); } -// The standard guest-invite form (ONE field: the guest's email). The inviter -// is the logged-in member — automatic, no field; the portal applies the -// member-side protections (active member, one per 30 days, recipient checks) -// and, with the trial gate on, holds the request for approval. +// The standard guest-invite form: the guest's email (required) plus an +// OPTIONAL display name. The inviter is the logged-in member — automatic, no +// field; the portal applies the member-side protections (active member, one +// per 30 days, recipient checks) and, with the trial gate on, holds the +// request for approval. An empty name is never derived from the email. async function sendGuestInvite(ev) { if (ev) ev.preventDefault(); const email = ($('guest-email').value || '').trim(); + const name = ($('guest-name').value || '').trim(); const btn = $('guest-btn'); const label = btn.textContent; if (!email || email.indexOf('@') < 1) { flash('Enter their email address', false); return; } @@ -1036,7 +1043,7 @@ async function sendGuestInvite(ev) { try { const r = await fetch('/api/guests', { method: 'POST', headers: {'Content-Type': 'application/json'}, - body: JSON.stringify({ email }) + body: JSON.stringify({ email, name }) }); const d = await r.json().catch(() => ({})); if (!r.ok || d.error) { @@ -1044,6 +1051,7 @@ async function sendGuestInvite(ev) { return; } $('guest-email').value = ''; + $('guest-name').value = ''; flash(d.note || 'Request sent — waiting for approval.', true); await loadGuests(); } catch (e) {