diff --git a/frontend/assets/verify.js b/frontend/assets/verify.js index 15f9d9a..55615ac 100644 --- a/frontend/assets/verify.js +++ b/frontend/assets/verify.js @@ -41,6 +41,27 @@ bn.className = "badge"; bn.textContent = "anonymous result"; badges.appendChild(bn); + var cs = $("claimSection"); + if (cs) cs.style.display = ""; + var cb = $("claimX"); + if (cb) cb.addEventListener("click", function () { + cb.disabled = true; + fetch("/auth/x/start?result_id=" + rid) + .then(function (r) { + if (r.status === 503) throw new Error("not_configured"); + if (!r.ok) throw new Error("http " + r.status); + return r.json(); + }) + .then(function (data) { window.location.href = data.authorize_url; }) + .catch(function (e) { + cb.disabled = false; + var err = $("claimErr"); + err.style.display = ""; + err.textContent = e.message === "not_configured" + ? "Identity binding is being set up — try again later." + : "Claim failed: " + e.message; + }); + }); } $("kvId").textContent = d.result_id; diff --git a/frontend/verify.html b/frontend/verify.html index eeb8fe9..f07968d 100644 --- a/frontend/verify.html +++ b/frontend/verify.html @@ -23,6 +23,17 @@
+ +