47de249a8b
Not signed in: grade, verdict, first finding and the opinion line; the rest (scores, findings, chain facts, screenshot, evidence) stays on the server. Join or sign in by one-time email link (hub /v1/join with the wwi.ref sponsor when HUB_JOIN=1; staging reads only). 1 free check a day without an account, 3 for members. Red flags deduped (deterministic VERIFIED one kept), grade recomputed on read. Privacy: joining and emails. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
20 lines
1.4 KiB
JavaScript
20 lines
1.4 KiB
JavaScript
// /join: one email form for joining free and for signing in (a one-time link). Lands back on ?to= (the report that was locked).
|
|
(function () {
|
|
'use strict';
|
|
var $ = WWI.$, q = new URLSearchParams(location.search);
|
|
var to = q.get('to') || '/my'; if (!/^\/(?!\/)/.test(to)) to = '/my';
|
|
if (q.get('err')) $('msg').textContent = q.get('err');
|
|
$('hubBtn').href = '/sso/start?mode=go&to=' + encodeURIComponent(to);
|
|
fetch('/api/config').then(function (r) { return r.json(); }).then(function (c) { if (c.member) { $('form').classList.add('hide'); $('msg').innerHTML = 'You are signed in. <a href="' + WWI.esc(to) + '">Continue</a>'; } });
|
|
$('form').addEventListener('submit', function (e) {
|
|
e.preventDefault(); $('go').disabled = true; $('msg').textContent = '';
|
|
WWI.post('/api/join', { email: $('email').value.trim(), optin: $('optin').checked, to: to }).then(function (j) {
|
|
$('go').disabled = false;
|
|
if (!j.ok) { $('msg').textContent = j.error || 'That did not work. Try again.'; return; }
|
|
if (j.mailed) $('msg').textContent = 'Check your inbox: we sent a link that signs you in (or creates your free account). It works for 30 minutes.';
|
|
else if (j.testLink) $('msg').innerHTML = 'Staging test address: no email is sent. <a href="' + WWI.esc(j.testLink) + '">Open the sign-in link</a>.';
|
|
else $('msg').textContent = j.note || 'No link was sent.';
|
|
});
|
|
});
|
|
})();
|