708e87ada524

fill detected form fields after new-entry save in both login and signup modes; record into filledForms to suppress reopens

time
2026-04-26 18:17 UTC · 6 months ago
machine
koh2
parent
fb549556f757
2 files src/content/index.ts+10 −0src/content/inject.ts+7 −4
src/content/index.ts+10 −0
@@ -433,6 +433,16 @@433433     {434434       domain,435435       searchableEntries,436+      // After State 5 (new entry) save: fill the detected fields with the437+      // freshly-created credentials so the user can submit immediately.438+      // On a login form the user created the entry to use here; on a signup439+      // form the password was generated for this site. Same outcome either440+      // way — the credentials land in the form and the popup exits.441+      onFillFields: (username, password) => {442+        const form = passwordEl.closest("form") as HTMLFormElement | null;443+        fillFields(usernameEl, passwordEl, username, password, form, getPageDomain());444+        recordFillSuccess(anchorField, usernameEl, passwordEl);445+      },436446       onDismiss: () => { lastDismissedField = anchorField; startDismissLock(); },437447     }438448   );

view file

src/content/inject.ts+7 −4
@@ -921,10 +921,13 @@921921           payload: { title, url: ug.inp.value.trim(), username, password: pw, type: "login" },922922         });923923         if ((res as { ok?: boolean }).ok) {924-          // In signup mode, fill the username + password fields on the page925-          if (options.isSignup && options.onFillFields) {926-            options.onFillFields(username, pw);927-          }924+          // Fill the detected form regardless of mode. For login the user925+          // created an entry to use here; for signup the password was just926+          // generated for this site. Either way the credentials land in927+          // the form. options.onFillFields is wired by the caller (index.ts)928+          // and also records the form into filledForms so the popup will929+          // not re-attach to the filled fields.930+          options.onFillFields?.(username, pw);928931           showSuccess(title);929932         } else {930933           const errMsg = (res as { error?: string }).error === "vault locked"

view file