mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1134881 - Sync password timeCreated & timePasswordChanged fields. r=rnewman
This commit is contained in:
parent
59dc5e202d
commit
e855eb7456
@ -22,6 +22,7 @@ LoginRec.prototype = {
|
||||
Utils.deferGetSet(LoginRec, "cleartext", [
|
||||
"hostname", "formSubmitURL",
|
||||
"httpRealm", "username", "password", "usernameField", "passwordField",
|
||||
"timeCreated", "timePasswordChanged",
|
||||
]);
|
||||
|
||||
|
||||
@ -98,6 +99,13 @@ function PasswordStore(name, engine) {
|
||||
PasswordStore.prototype = {
|
||||
__proto__: Store.prototype,
|
||||
|
||||
_newPropertyBag: function () {
|
||||
return Cc["@mozilla.org/hash-property-bag;1"].createInstance(Ci.nsIWritablePropertyBag2);
|
||||
},
|
||||
|
||||
/**
|
||||
* Return an instance of nsILoginInfo (and, implicitly, nsILoginMetaInfo).
|
||||
*/
|
||||
_nsLoginInfoFromRecord: function (record) {
|
||||
function nullUndefined(x) {
|
||||
return (x == undefined) ? null : x;
|
||||
@ -118,13 +126,21 @@ PasswordStore.prototype = {
|
||||
record.password,
|
||||
record.usernameField,
|
||||
record.passwordField);
|
||||
|
||||
info.QueryInterface(Ci.nsILoginMetaInfo);
|
||||
info.guid = record.id;
|
||||
if (record.timeCreated) {
|
||||
info.timeCreated = record.timeCreated;
|
||||
}
|
||||
if (record.timePasswordChanged) {
|
||||
info.timePasswordChanged = record.timePasswordChanged;
|
||||
}
|
||||
|
||||
return info;
|
||||
},
|
||||
|
||||
_getLoginFromGUID: function (id) {
|
||||
let prop = Cc["@mozilla.org/hash-property-bag;1"].createInstance(Ci.nsIWritablePropertyBag2);
|
||||
let prop = this._newPropertyBag();
|
||||
prop.setPropertyAsAUTF8String("guid", id);
|
||||
|
||||
let logins = Services.logins.searchLogins({}, prop);
|
||||
@ -169,8 +185,7 @@ PasswordStore.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
let prop = Cc["@mozilla.org/hash-property-bag;1"]
|
||||
.createInstance(Ci.nsIWritablePropertyBag2);
|
||||
let prop = this._newPropertyBag();
|
||||
prop.setPropertyAsAUTF8String("guid", newID);
|
||||
|
||||
Services.logins.modifyLogin(oldLogin, prop);
|
||||
@ -197,6 +212,11 @@ PasswordStore.prototype = {
|
||||
record.usernameField = login.usernameField;
|
||||
record.passwordField = login.passwordField;
|
||||
|
||||
// Optional fields.
|
||||
login.QueryInterface(Ci.nsILoginMetaInfo);
|
||||
record.timeCreated = login.timeCreated;
|
||||
record.timePasswordChanged = login.timePasswordChanged;
|
||||
|
||||
return record;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user