mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-01 23:01:28 +01:00
smarter username field selection for no form condition
This commit is contained in:
parent
790d705d40
commit
36b580d60a
@ -104,9 +104,25 @@ function initAutofill() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (passwordFields.length == 1) {
|
else if (passwordFields.length == 1) {
|
||||||
|
// The page does not have any forms with password fields. Use the one password field on the page and the
|
||||||
|
// input field just before it as the username.
|
||||||
|
|
||||||
password = passwordFields[0];
|
password = passwordFields[0];
|
||||||
if (password.elementNumber > 0) {
|
if (password.elementNumber > 0) {
|
||||||
username = pageDetails.fields[password.elementNumber - 1];
|
for (i = 0; i < pageDetails.fields.length; i++) {
|
||||||
|
f = pageDetails.fields[i];
|
||||||
|
if (f.elementNumber > password.elementNumber) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (f.type === 'text' || f.type === 'email') {
|
||||||
|
username = f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!username) {
|
||||||
|
username = pageDetails.fields[password.elementNumber - 1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user