fix(profile): show active/revoked status for app passwords

Add Status column to app passwords table with Active/Revoked badge.
Only show the revoke button for active passwords.
This commit is contained in:
Jared Wolff
2026-03-05 17:02:43 -05:00
parent 9adcdc436f
commit 405cb54240
2 changed files with 20 additions and 8 deletions
+19 -7
View File
@@ -152,14 +152,26 @@ function renderPwRow(pw) {
created.textContent = new Date(pw.created_at).toLocaleDateString(); created.textContent = new Date(pw.created_at).toLocaleDateString();
const lastUsed = document.createElement('td'); const lastUsed = document.createElement('td');
lastUsed.textContent = pw.last_used_at ? timeAgo(pw.last_used_at) : 'Never'; lastUsed.textContent = pw.last_used_at ? timeAgo(pw.last_used_at) : 'Never';
const status = document.createElement('td');
const badge = document.createElement('span');
if (pw.active !== false) {
badge.className = 'badge badge-active';
badge.textContent = 'Active';
} else {
badge.className = 'badge badge-expired';
badge.textContent = 'Revoked';
}
status.appendChild(badge);
const actions = document.createElement('td'); const actions = document.createElement('td');
const btn = document.createElement('button'); if (pw.active !== false) {
btn.className = 'btn btn-danger-sm'; const btn = document.createElement('button');
btn.innerHTML = '<i class="fas fa-trash"></i>'; btn.className = 'btn btn-danger-sm';
btn.title = 'Revoke'; btn.innerHTML = '<i class="fas fa-trash"></i>';
btn.addEventListener('click', function () { revokeAppPassword(pw.id, pw.label); }); btn.title = 'Revoke';
actions.appendChild(btn); btn.addEventListener('click', function () { revokeAppPassword(pw.id, pw.label); });
tr.append(label, created, lastUsed, actions); actions.appendChild(btn);
}
tr.append(label, created, lastUsed, status, actions);
return tr; return tr;
} }
+1 -1
View File
@@ -116,7 +116,7 @@
<table class="app-pw-table" id="app-pw-table"> <table class="app-pw-table" id="app-pw-table">
<thead> <thead>
<tr><th>Label</th><th>Created</th><th>Last Used</th><th></th></tr> <tr><th>Label</th><th>Created</th><th>Last Used</th><th>Status</th><th></th></tr>
</thead> </thead>
<tbody id="app-pw-tbody"></tbody> <tbody id="app-pw-tbody"></tbody>
</table> </table>