Enlace de invitado = nombre + fecha de grabación (sin códigos)
Válido de 14 días antes a 10 días después de la fecha. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSyR5Zw5eGj6oPTRVjvP1b
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
da8cc01fad
commit
1b82ae24a7
+4
-4
@@ -1,13 +1,13 @@
|
||||
(function () {
|
||||
var $ = function (id) { return document.getElementById(id); };
|
||||
var k = (new URLSearchParams(location.search).get('k') || '').trim();
|
||||
var P = new URLSearchParams(location.search), n = (P.get('n') || '').trim(), fe = (P.get('f') || '').trim(), k = n && fe ? n + fe : '';
|
||||
var f = $('g'), st = $('st'), hola = $('hola'), malo = $('malo'), intro = $('intro');
|
||||
var t0 = Date.now(), busy = false, KEY = 'aqnsn-ficha-' + k.slice(0, 10);
|
||||
var t0 = Date.now(), busy = false, KEY = 'aqnsn-ficha-' + k.slice(0, 40);
|
||||
function say(m, ok) { st.textContent = m; st.className = 'status ' + (ok ? 'ok' : 'err'); }
|
||||
function store(op, v) { try { return op === 'get' ? localStorage.getItem(KEY) : op === 'set' ? localStorage.setItem(KEY, v) : localStorage.removeItem(KEY); } catch (e) { return null; } }
|
||||
if (!k) { malo.hidden = false; return; }
|
||||
|
||||
fetch('/api/invitados/check?k=' + encodeURIComponent(k), { cache: 'no-store' })
|
||||
fetch('/api/invitados/check?n=' + encodeURIComponent(n) + '&f=' + encodeURIComponent(fe), { cache: 'no-store' })
|
||||
.then(function (r) { return r.json(); })
|
||||
.then(function (j) {
|
||||
if (!j.ok) { malo.hidden = false; return; }
|
||||
@@ -40,7 +40,7 @@
|
||||
if (email && !/^[^@\s]+@[^@\s]+\.[^@\s]{2,}$/.test(email)) { say('El correo no parece válido.', false); return; }
|
||||
busy = true; say('Enviando…', true);
|
||||
fetch('/api/invitados', { method: 'POST', headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ k: k, email: email, resp: resp, consent: true, web: f.web.value || '', t: Date.now() - t0 }) })
|
||||
body: JSON.stringify({ n: n, f: fe, email: email, resp: resp, consent: true, web: f.web.value || '', t: Date.now() - t0 }) })
|
||||
.then(function (r) { return r.json().catch(function () { return {}; }).then(function (j) { return { ok: r.ok && j.ok, j: j }; }); })
|
||||
.then(function (x) {
|
||||
if (x.ok) { store('del'); f.reset(); Array.prototype.forEach.call(f.querySelectorAll('fieldset,label,button,.note'), function (n) { n.hidden = true; }); say(f.getAttribute('data-ok'), true); }
|
||||
|
||||
Reference in New Issue
Block a user