Tests ADN / test (push) Canceled after 0s
- Base: código de producción de srvv-nexxa (1.2.1), importado y verificado por hash (P335/F3) - Pools por individuo (lib_pools): mente y red, mezclan proveedores, keys compartidas o exclusivas - API: /disponible/mente|red y /estado por rol, pool_vacio explícito, /pools (CRUD admin), liberar admin - Revertir el agotada propio + motivo y quién la agotó (de P334/F4) - nexxa-web: sección Pools, motivo y botón Liberar, provider libre con sugerencias, escape de texto externo - Convención REG002: lib_*, cli_*, tool_humo_pool; contratos externos con su nombre - Suite local sobre copia aislada: humo HTTP, pools, revertir; servidor_prueba para mirar la web Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: GEMMA <noreply@gemma.dtic>
44 lines
1.4 KiB
JavaScript
44 lines
1.4 KiB
JavaScript
(function () {
|
|
"use strict";
|
|
|
|
var form = document.getElementById("login-form");
|
|
var usuarioInput = document.getElementById("f-usuario");
|
|
var passwordInput = document.getElementById("f-password");
|
|
var submitBtn = document.getElementById("login-submit");
|
|
var errorEl = document.getElementById("login-error");
|
|
var versionEl = document.getElementById("version-tag");
|
|
|
|
if (versionEl) {
|
|
fetch("/version")
|
|
.then(function (r) { return r.json(); })
|
|
.then(function (d) { versionEl.textContent = "v" + d.version; })
|
|
.catch(function () {});
|
|
}
|
|
|
|
form.addEventListener("submit", function (e) {
|
|
e.preventDefault();
|
|
errorEl.classList.remove("visible");
|
|
submitBtn.disabled = true;
|
|
|
|
fetch("/login", {
|
|
method: "POST",
|
|
headers: { "Content-Type": "application/json" },
|
|
body: JSON.stringify({ usuario: usuarioInput.value, password: passwordInput.value })
|
|
})
|
|
.then(function (r) {
|
|
return r.json().then(function (data) { return { ok: r.ok, data: data }; });
|
|
})
|
|
.then(function (result) {
|
|
if (!result.ok) throw new Error(result.data.error || "Usuario o password incorrectos");
|
|
location.reload();
|
|
})
|
|
.catch(function (err) {
|
|
errorEl.textContent = err.message;
|
|
errorEl.classList.add("visible");
|
|
passwordInput.value = "";
|
|
passwordInput.focus();
|
|
submitBtn.disabled = false;
|
|
});
|
|
});
|
|
})();
|