cleanup autofill service a bit
This commit is contained in:
parent
0bcc764274
commit
1c3143867b
|
@ -78,16 +78,8 @@ function initAutofill() {
|
||||||
};
|
};
|
||||||
|
|
||||||
var isoProvinces = {
|
var isoProvinces = {
|
||||||
alberta: 'AB',
|
alberta: 'AB', 'british columbia': 'BC', manitoba: 'MB', 'new brunswick': 'NB', 'newfoundland and labrador': 'NL',
|
||||||
'british columbia': 'BC',
|
'nova scotia': 'NS', ontario: 'ON', 'prince edward island': 'PE', quebec: 'QC', saskatchewan: 'SK'
|
||||||
manitoba: 'MB',
|
|
||||||
'new brunswick': 'NB',
|
|
||||||
'newfoundland and labrador': 'NL',
|
|
||||||
'nova scotia': 'NS',
|
|
||||||
ontario: 'ON',
|
|
||||||
'prince edward island': 'PE',
|
|
||||||
quebec: 'QC',
|
|
||||||
saskatchewan: 'SK'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AutofillService.prototype.getFormsWithPasswordFields = function (pageDetails) {
|
AutofillService.prototype.getFormsWithPasswordFields = function (pageDetails) {
|
||||||
|
@ -95,25 +87,29 @@ function initAutofill() {
|
||||||
formData = [];
|
formData = [];
|
||||||
|
|
||||||
passwordFields = loadPasswordFields(pageDetails, true);
|
passwordFields = loadPasswordFields(pageDetails, true);
|
||||||
if (passwordFields.length) {
|
if (!passwordFields.length) {
|
||||||
for (var formKey in pageDetails.forms) {
|
return formData;
|
||||||
for (var i = 0; i < passwordFields.length; i++) {
|
}
|
||||||
var pf = passwordFields[i];
|
|
||||||
if (formKey === pf.form) {
|
|
||||||
var uf = findUsernameField(pageDetails, pf, false, false);
|
|
||||||
if (!uf) {
|
|
||||||
// not able to find any viewable username fields. maybe there are some "hidden" ones?
|
|
||||||
uf = findUsernameField(pageDetails, pf, true, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
formData.push({
|
for (var formKey in pageDetails.forms) {
|
||||||
form: pageDetails.forms[formKey],
|
for (var i = 0; i < passwordFields.length; i++) {
|
||||||
password: pf,
|
var pf = passwordFields[i];
|
||||||
username: uf
|
if (formKey !== pf.form) {
|
||||||
});
|
continue;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var uf = findUsernameField(pageDetails, pf, false, false);
|
||||||
|
if (!uf) {
|
||||||
|
// not able to find any viewable username fields. maybe there are some "hidden" ones?
|
||||||
|
uf = findUsernameField(pageDetails, pf, true, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
formData.push({
|
||||||
|
form: pageDetails.forms[formKey],
|
||||||
|
password: pf,
|
||||||
|
username: uf
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue