From 8f8106742ac9c3b5aa49ac3da5216c9bce0da8dc Mon Sep 17 00:00:00 2001 From: Inferencebot Date: Sun, 8 Nov 2026 02:55:23 +0000 Subject: [PATCH] Standard guest-invite form: one email field, no name input MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same form as the admin panel: 'Invite a guest' heading, a single required email input, a 'Send invite' button, submit on Enter. The inviter is the logged-in member (automatic); the portal applies the one-per-30-days rule, recipient checks and the pending-approval gate as before. No name is collected or derived — the guest chooses their own at Cloudron setup. --- app/main.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/app/main.py b/app/main.py index 42ed92c..144e317 100644 --- a/app/main.py +++ b/app/main.py @@ -630,7 +630,9 @@ PAGE_HTML = """ /* ---------- Guest access (members inviting a friend) ---------- */ .guest-hint { color: var(--muted); font-size: 12px; margin-bottom: 12px; } - .new-key .name-input { max-width: 200px; } + /* Standard guest-invite form (shared with the admin panel): ONE field. */ + .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; } .guest-trail { margin-top: 6px; } .guest-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; @@ -843,11 +845,12 @@ PAGE_HTML = """ @@ -1018,9 +1021,13 @@ function renderGuests(d) { }).join(''); } -async function sendGuestInvite() { +// 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. +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; } @@ -1029,7 +1036,7 @@ async function sendGuestInvite() { try { const r = await fetch('/api/guests', { method: 'POST', headers: {'Content-Type': 'application/json'}, - body: JSON.stringify({ email, name }) + body: JSON.stringify({ email }) }); const d = await r.json().catch(() => ({})); if (!r.ok || d.error) { @@ -1037,7 +1044,6 @@ async function sendGuestInvite() { return; } $('guest-email').value = ''; - $('guest-name').value = ''; flash(d.note || 'Request sent — waiting for approval.', true); await loadGuests(); } catch (e) {