Files
GTI_GERENCIADOR_FISCAL/central/static/sidebar.js
T
gtiandClaude Opus 5.5 64d3fc56e2 feat: SSO from GTI Gerenciador and the Gerenciador visual identity
Collaborators logged into GTI Gerenciador open GTI Fiscal without a
second password. The panel signs a 60 s JWT (Ed25519; the Hub holds only
the public key); the Hub checks signature, iss/aud/exp/nbf, maximum
lifetime, nonce against a one-time state cookie set when the flow starts
at GET /login (login-CSRF protection) and a single-use jti
(sso_used_assertions). Collaborators are provisioned in admin_users with
auth_source=GTI_GERENCIADOR and no password; a CHECK constraint makes a
passwordless local account or a federated account with a password
impossible (migration 0021). Sessions last FEDERATED_SESSION_SECONDS
(1 h) and are renewed silently through the panel.

The local admin stays as break-glass at /login/local, audited. Logout ends
only the Hub session. Every SSO success/rejection (stable reason code),
logout and local login is audited with the real client IP, never the
token. verify_password now fails closed on a missing hash instead of
raising.

Visual identity: gti-theme.css is a verbatim copy of the panel's
design system (tokens, sidebar, light/dark theme) plus its tema.js,
sidebar.js and logo; control-panel.css keeps only Hub components, all
colours from the panel tokens. Page structure and features unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 12:21:26 -03:00

40 lines
1.3 KiB
JavaScript

// app/static/sidebar.js — abre/fecha a gaveta da sidebar no mobile e
// recolhe/expande no desktop, persistindo a preferência de recolher.
(function () {
var sidebar = document.getElementById("sidebar");
var backdrop = document.getElementById("sidebar-backdrop");
var btnMenuMobile = document.getElementById("btn-menu-mobile");
var btnRecolher = document.getElementById("botao-recolher");
if (!sidebar) return;
function abrirGaveta() {
sidebar.classList.add("aberta");
if (backdrop) backdrop.classList.add("aberta");
}
function fecharGaveta() {
sidebar.classList.remove("aberta");
if (backdrop) backdrop.classList.remove("aberta");
}
if (btnMenuMobile) {
btnMenuMobile.addEventListener("click", function () {
if (sidebar.classList.contains("aberta")) fecharGaveta();
else abrirGaveta();
});
}
if (backdrop) backdrop.addEventListener("click", fecharGaveta);
sidebar.querySelectorAll("a").forEach(function (link) {
link.addEventListener("click", fecharGaveta);
});
if (btnRecolher) {
if (localStorage.getItem("sidebarRecolhida") === "1") {
sidebar.classList.add("recolhida");
}
btnRecolher.addEventListener("click", function () {
var recolhida = sidebar.classList.toggle("recolhida");
localStorage.setItem("sidebarRecolhida", recolhida ? "1" : "0");
});
}
})();