OverviewFilesCommitsIssuesDocsReleasesPeers

hyper-wallet commits / 07edd5b

Fix stale token detection after server restart
CRITICAL FIX: Password dialog wasn't triggering after server restart Problem: - Server restarts and loses password cache in memory - Client still has valid token in localStorage - Token exists but useless (all API calls fail with "Password not cached") - Password dialog never triggers because getToken() returns a token Solution: 1. checkStatus() now returns full status data (not just boolean) 2. In init(), detect stale token: passwordCached=false + token exists 3. Clear stale token and trigger password prompt This fixes the "Password not cached" loop after server restarts. User report: "getting this again" - seeing password errors on every page load Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
07edd5b0fdf2278ff3b0b656a211cdffd50f62e9
by plankatron <fleeky@gmail.com> · 2026-01-27T22:55:18.000Z

Changed files (1) +22 -11

ui/app.js +22 -11
……@@ -1712,17 +1712,17 @@ async function checkStatus() {
17121712 if (!data.initialized) {
17131713 // Show setup wizard instead of error
17141714 showSetupWizard()
1715 return false
1715 return { initialized: false }
17161716 }
17171717
17181718 document.getElementById('wallet-status').innerHTML = '✅ Ready'
17191719 // Network name is set by updateNetworkLabels() based on selectedNetwork
1720 return true
1720 return data
17211721 } catch (err) {
17221722 console.error('Status check failed:', err)
17231723 document.getElementById('wallet-status').innerHTML = '❌ Server Error'
17241724 showError('Cannot connect to wallet server')
1725 return false
1725 return { initialized: false }
17261726 }
17271727}
17281728
……@@ -2769,15 +2769,26 @@ async function init() {
27692769 // Update network labels
27702770 updateNetworkLabels()
27712771
2772 const initialized = await checkStatus()
2772 const status = await checkStatus()
27732773
2774 // If initialized but no API token, prompt for password
2775 if (initialized && !getToken()) {
2776 console.log('🔐 Wallet initialized but password needed')
2777 const success = await promptForPassword()
2778 if (!success) {
2779 showError('Failed to unlock wallet. Please refresh and try again.')
2780 return
2774 // If initialized, check if we need to prompt for password
2775 if (status.initialized) {
2776 const token = getToken()
2777
2778 // If password not cached on server but we have a token, it's stale
2779 if (status.passwordCached === false && token) {
2780 console.log('🔐 Stale token detected - clearing and prompting for password')
2781 clearToken()
2782 }
2783
2784 // If no token (or cleared stale token), prompt for password
2785 if (!getToken()) {
2786 console.log('🔐 Wallet initialized but password needed')
2787 const success = await promptForPassword()
2788 if (!success) {
2789 showError('Failed to unlock wallet. Please refresh and try again.')
2790 return
2791 }
27812792 }
27822793 }
27832794