Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.

Commit 493b1b7

Browse files
committed
fix: replace confirm() with modal for passkey deletion, add missing toast styles
- Replace browser confirm() dialog with the app's custom modal - Add .toast-info and .toast-warning CSS classes (were missing) - Passkey info toasts now have proper background/border/color
1 parent 9a48179 commit 493b1b7

2 files changed

Lines changed: 42 additions & 11 deletions

File tree

public/css/style.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,18 @@ tbody tr:hover {
12281228
color: var(--accent-red);
12291229
}
12301230

1231+
.toast-info {
1232+
background: rgba(56, 132, 255, 0.15);
1233+
border: 1px solid rgba(56, 132, 255, 0.3);
1234+
color: var(--accent-1);
1235+
}
1236+
1237+
.toast-warning {
1238+
background: rgba(251, 191, 36, 0.15);
1239+
border: 1px solid rgba(251, 191, 36, 0.3);
1240+
color: var(--accent-yellow);
1241+
}
1242+
12311243
@keyframes slideUp {
12321244
from { opacity: 0; transform: translateY(20px); }
12331245
to { opacity: 1; transform: translateY(0); }

public/js/app.js

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2455,18 +2455,37 @@ async function handleRegisterPasskey() {
24552455
}
24562456

24572457
async function handleDeletePasskey(id) {
2458-
if (!confirm('Delete this passkey? You will no longer be able to use it to sign in.')) return;
2459-
try {
2460-
await api(`/auth/passkeys/${id}`, { method: 'DELETE' });
2461-
showToast('Passkey deleted', 'info');
2462-
loadPasskeys();
2463-
} catch (err) {
2464-
const status = $('#passkey-status');
2465-
if (status) {
2466-
status.textContent = err.message;
2467-
status.style.color = 'var(--accent-red)';
2458+
const overlay = $('#modal-overlay');
2459+
const content = $('#modal-content');
2460+
content.innerHTML = html`
2461+
<div class="modal-title">Delete Passkey</div>
2462+
<p style="color:var(--text-secondary);line-height:1.6;margin-bottom:16px">
2463+
Are you sure you want to delete this passkey? You will no longer be able to use it to sign in.
2464+
</p>
2465+
<div class="modal-actions">
2466+
<button class="btn btn-ghost btn-full modal-cancel-btn">Cancel</button>
2467+
<button class="btn btn-danger btn-full" id="confirm-delete-passkey-btn">Delete</button>
2468+
</div>
2469+
`;
2470+
overlay.classList.add('open');
2471+
2472+
const confirmBtn = $('#confirm-delete-passkey-btn');
2473+
const newBtn = confirmBtn.cloneNode(true);
2474+
confirmBtn.replaceWith(newBtn);
2475+
newBtn.addEventListener('click', async () => {
2476+
overlay.classList.remove('open');
2477+
try {
2478+
await api(`/auth/passkeys/${id}`, { method: 'DELETE' });
2479+
showToast('Passkey deleted', 'info');
2480+
loadPasskeys();
2481+
} catch (err) {
2482+
const status = $('#passkey-status');
2483+
if (status) {
2484+
status.textContent = err.message;
2485+
status.style.color = 'var(--accent-red)';
2486+
}
24682487
}
2469-
}
2488+
});
24702489
}
24712490

24722491
function formatDate(d) {

0 commit comments

Comments
 (0)