Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit de1b976

Browse files
fmeummsfjarvis
authored andcommitted
Mark unfocused single password fields as fillable (#1258)
Unfocused single password fields in forms with no other recognized fields must be marked as fillable or the Autofill service will no longer be invoked on that form. This is compatible with the restrictions of single-origin mode as filling only takes place after the password field has gained focus and the user has tapped the fill UI. For an example website where fill UI is not shown without this commit, open https://amazon.lbb.de and tab the user name field ("Benutzername") first before focusing the password field. (cherry picked from commit c15594b)
1 parent eaa541b commit de1b976

File tree

1 file changed

+20
-0
lines changed
  • autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser

1 file changed

+20
-0
lines changed

autofill-parser/src/main/java/com/github/androidpasswordstore/autofillparser/AutofillStrategy.kt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,26 @@ internal val autofillStrategy = strategy {
187187
}
188188
}
189189

190+
// Fallback rule for the case of a login form with a password field and other fields that are
191+
// not recognized by any other rule. If one of the other fields is focused and we return no
192+
// response, the system will not invoke the service again if focus later changes to the password
193+
// field. Hence, we must mark it as fillable now.
194+
// This rule can apply in single origin mode since even though the password field may not be
195+
// focused at the time the rule runs, the fill suggestion will only show if it ever receives
196+
// focus.
197+
rule(applyInSingleOriginMode = true) {
198+
currentPassword {
199+
takeSingle { hasAutocompleteHintCurrentPassword }
200+
}
201+
}
202+
203+
// See above.
204+
rule(applyInSingleOriginMode = true) {
205+
genericPassword {
206+
takeSingle { true }
207+
}
208+
}
209+
190210
// Match any focused password field with optional username field on manual request.
191211
rule(applyInSingleOriginMode = true, applyOnManualRequestOnly = true) {
192212
genericPassword {

0 commit comments

Comments
 (0)