| … | … | @@ -2252,6 +2252,21 @@ Enter your wallet password: |
| 2252 | 2252 | continue |
| 2253 | 2253 | } |
| 2254 | 2254 | |
| 2255 | // For first-time setup, ask for confirmation |
| 2256 | if (isFirstTimeSetup) { |
| 2257 | const confirmPassword = prompt('🔐 CONFIRM PASSWORD\n\nPlease re-enter your password to confirm:') |
| 2258 | |
| 2259 | if (confirmPassword === null) { |
| 2260 | continue // Let them try again |
| 2261 | } |
| 2262 | |
| 2263 | if (password !== confirmPassword) { |
| 2264 | alert('❌ Passwords do not match. Please try again.') |
| 2265 | attempts++ |
| 2266 | continue |
| 2267 | } |
| 2268 | } |
| 2269 | |
| 2255 | 2270 | try { |
| 2256 | 2271 | // Call unlock endpoint |
| 2257 | 2272 | const res = await fetch(`${API_BASE}/unlock`, { |
| … | … | @@ -2276,8 +2291,8 @@ Enter your wallet password: |
| 2276 | 2291 | |
| 2277 | 2292 | const data = await res.json() |
| 2278 | 2293 | |
| 2279 | | // Store API token |
| 2280 | | localStorage.setItem('apiToken', data.token) |
| 2294 | // Store API token using the correct function |
| 2295 | saveToken(data.token) |
| 2281 | 2296 | |
| 2282 | 2297 | // Show success message |
| 2283 | 2298 | if (data.migrated) { |
| … | … | @@ -2320,7 +2335,7 @@ async function init() { |
| 2320 | 2335 | const initialized = await checkStatus() |
| 2321 | 2336 | |
| 2322 | 2337 | // If initialized but no API token, prompt for password |
| 2323 | | if (initialized && !localStorage.getItem('apiToken')) { |
| 2338 | if (initialized && !getToken()) { |
| 2324 | 2339 | console.log('🔐 Wallet initialized but password needed') |
| 2325 | 2340 | const success = await promptForPassword() |
| 2326 | 2341 | if (!success) { |