Closed Bug 1285575 Opened 8 years ago Closed 7 years ago

Allow distinguishing imported passwords so we can remove only those passwords (so that we can make 'undo' of automatic import available for longer)

Categories

(Firefox :: Migration, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1285577
Tracking Status
firefox50 --- affected

People

(Reporter: Gijs, Unassigned)

References

Details

Right now the 'undo' functionality just wipes out all the passwords. To make this better, we need:

1) some way of tagging the autoimported passwords in the login/pwd manager
2) use this in the various browser importers
3) an API to remove all these logins based on their tag
One idea would be to persist an array of login GUIDs outside of pwmgr. This doesn't require any change to pwmgr code.
(In reply to Matthew N. [:MattN] from comment #1)
> One idea would be to persist an array of login GUIDs outside of pwmgr. This
> doesn't require any change to pwmgr code.

Can we remove the logins by GUID? I don't think the pwmgr code allows looking up or removing logins by guid. In fact, the guid isn't even exposed on nsILoginInfo, AFAICT. :-\
I believe you can lookup logins by GUID with searchLogins. See https://dxr.mozilla.org/mozilla-central/rev/e78975b53563d80c99ebfbdf8a9fbf6b829a8a48/services/sync/modules/engines/passwords.js#150 where the sync code does exactly this.
Priority: -- → P3
You can use searchLoginsWithObject for a nicer API btw.
(In reply to Matthew N. [:MattN] from comment #4)
> You can use searchLoginsWithObject for a nicer API btw.

And how would we know the guid of the item? Do we need a separate search for that? :-(

Does the guid change if the login is changed/updated? (ie, what happens if we import, then the user changes the login, then the user uses 'undo' with the import?)
Flags: needinfo?(MattN+bmo)
(In reply to :Gijs Kruitbosch from comment #2)
> In fact, the guid isn't even exposed on nsILoginInfo, AFAICT. :-\

(In reply to :Gijs Kruitbosch from comment #5)
> And how would we know the guid of the item? Do we need a separate search for
> that? :-(

It's on nsILoginMetaInfo.

> Does the guid change if the login is changed/updated? (ie, what happens if
> we import, then the user changes the login, then the user uses 'undo' with
> the import?)

No, it never changes. If you don't want to delete/undo logins that have changed since import, I would recommend storing both the guid and the timePasswordChanged and maybe don't delete if the timePasswordChanged is different.
Flags: needinfo?(MattN+bmo)
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.