From fbf886c2a5bf62d973f710577bd30091d4d642ce Mon Sep 17 00:00:00 2001 From: Brooke Date: Fri, 10 Jul 2026 15:45:07 -0700 Subject: [PATCH] add confirmation step to password reset --- web/src/AccountsPanel.tsx | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/web/src/AccountsPanel.tsx b/web/src/AccountsPanel.tsx index 02716b6..10ba22f 100644 --- a/web/src/AccountsPanel.tsx +++ b/web/src/AccountsPanel.tsx @@ -23,7 +23,7 @@ export function AccountsPanel({ appviewUrl }: { appviewUrl: string }) { const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const [busyDid, setBusyDid] = useState(null); - const [confirmDid, setConfirmDid] = useState(null); + const [confirm, setConfirm] = useState<{ did: string; action: "status" | "reset" } | null>(null); const [menuDid, setMenuDid] = useState(null); const [passwordResult, setPasswordResult] = useState<{ handle: string; password: string } | null>( null, @@ -44,7 +44,7 @@ export function AccountsPanel({ appviewUrl }: { appviewUrl: string }) { const close = (e: MouseEvent | KeyboardEvent) => { if (e instanceof KeyboardEvent && e.key !== "Escape") return; setMenuDid(null); - setConfirmDid(null); + setConfirm(null); }; document.addEventListener("click", close); document.addEventListener("keydown", close); @@ -101,7 +101,7 @@ export function AccountsPanel({ appviewUrl }: { appviewUrl: string }) { const runAction = async (did: string, action: "takedown" | "enable" | "resetPassword") => { setBusyDid(did); - setConfirmDid(null); + setConfirm(null); try { if (action === "resetPassword") { const { password } = await api.resetPassword(did); @@ -172,26 +172,29 @@ export function AccountsPanel({ appviewUrl }: { appviewUrl: string }) { disabled={busyDid === a.did} onClick={() => { setMenuDid(menuDid === a.did ? null : a.did); - setConfirmDid(null); + setConfirm(null); }} > ⋯ {menuDid === a.did && (
- {confirmDid === a.did ? ( + {confirm?.did === a.did ? ( <> - @@ -218,15 +221,15 @@ export function AccountsPanel({ appviewUrl }: { appviewUrl: string }) { )}
- -- 2.51.2