[refactor](trx-frontend-http): consolidate to single auth interface
Remove duplicate logout button from About tab. Use only the header Login/Logout button for unified authentication control. The About tab now shows the authentication badge (when logged in) without the redundant logout button. Single login view: - Auth gate with Login form + Continue as Guest button (when no rx pass) - Header Login/Logout button for quick access - Auth badge in About tab showing current role Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
@@ -90,13 +90,11 @@ function showAuthError(msg) {
|
||||
}
|
||||
|
||||
function updateAuthUI() {
|
||||
const btn = document.getElementById("logout-btn");
|
||||
const badge = document.getElementById("auth-badge");
|
||||
const badgeRole = document.getElementById("auth-role-badge");
|
||||
const headerAuthBtn = document.getElementById("header-auth-btn");
|
||||
|
||||
if (authRole) {
|
||||
btn.style.display = "block";
|
||||
badge.style.display = "block";
|
||||
badgeRole.textContent = authRole === "control" ? "Control (full access)" : "RX (read-only)";
|
||||
if (headerAuthBtn) {
|
||||
@@ -104,7 +102,6 @@ function updateAuthUI() {
|
||||
headerAuthBtn.style.display = "block";
|
||||
}
|
||||
} else {
|
||||
btn.style.display = "none";
|
||||
badge.style.display = "none";
|
||||
if (headerAuthBtn) {
|
||||
headerAuthBtn.textContent = "Login";
|
||||
@@ -1276,13 +1273,6 @@ if (guestBtn) {
|
||||
});
|
||||
}
|
||||
|
||||
// Setup logout button
|
||||
document.getElementById("logout-btn").addEventListener("click", async () => {
|
||||
if (confirm("Are you sure you want to logout?")) {
|
||||
await authLogout();
|
||||
}
|
||||
});
|
||||
|
||||
// Setup header auth button (Login/Logout)
|
||||
const headerAuthBtn = document.getElementById("header-auth-btn");
|
||||
if (headerAuthBtn) {
|
||||
|
||||
@@ -239,10 +239,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="tab-about" class="tab-panel" style="display:none;">
|
||||
<div style="margin-bottom: 1rem;">
|
||||
<button id="logout-btn" type="button" style="display:none; padding: 0.5rem 1rem; background: var(--accent-red, #ff6b6b); color: var(--bg-primary); border: none; border-radius: 0.25rem; font-weight: 600; cursor: pointer;">Logout</button>
|
||||
<div id="auth-badge" style="display:none; margin-top: 0.5rem; color: var(--text-muted); font-size: 0.85rem;">Authenticated as: <strong id="auth-role-badge">--</strong></div>
|
||||
</div>
|
||||
<div id="auth-badge" style="display:none; margin-bottom: 1rem; padding: 0.5rem; background: var(--bg-secondary); border-radius: 0.25rem; color: var(--text-muted); font-size: 0.85rem;">Authenticated as: <strong id="auth-role-badge">--</strong></div>
|
||||
<table class="about-table">
|
||||
<tr><td>Server version</td><td id="about-server-ver">--</td></tr>
|
||||
<tr><td>Server address</td><td id="about-server-addr">--</td></tr>
|
||||
|
||||
Reference in New Issue
Block a user