From 09422be34e097e08bfcab9659537cbaf75365147 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Fri, 15 Jul 2022 16:42:13 -0700 Subject: [PATCH] Add support for confirm password fields --- .../kunzisoft/keepass/autofill/AutofillHelper.kt | 3 +++ .../keepass/autofill/KeeAutofillService.kt | 3 +++ .../kunzisoft/keepass/autofill/StructureParser.kt | 14 ++++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.kt index 7bde6e6a0..742f50050 100644 --- a/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.kt +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/AutofillHelper.kt @@ -123,6 +123,9 @@ object AutofillHelper { struct.passwordId?.let { passwordId -> builder.setValue(passwordId, AutofillValue.forText(entryInfo.password)) } + struct.confirmPasswordId?.let { confirmPasswordId -> + builder.setValue(confirmPasswordId, AutofillValue.forText(entryInfo.password)) + } if (entryInfo.expires) { val year = entryInfo.expiryTime.getYearInt() diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt index b80cc4b44..fbd0eb861 100644 --- a/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/KeeAutofillService.kt @@ -222,6 +222,9 @@ class KeeAutofillService : AutofillService() { } types = types or SaveInfo.SAVE_DATA_TYPE_PASSWORD requiredIds.add(passwordInfo) + parseResult.confirmPasswordId?.let { confirmPasswordId -> + requiredIds.add(confirmPasswordId) + } } // or a credit card form if (requiredIds.isEmpty()) { diff --git a/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt b/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt index d3378f90d..ae94a95f0 100644 --- a/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt +++ b/app/src/main/java/com/kunzisoft/keepass/autofill/StructureParser.kt @@ -120,8 +120,6 @@ class StructureParser(private val structure: AssistStructure) { for (i in 0 until node.childCount) { if (parseViewNode(node.getChildAt(i))) returnValue = true - if (domainNotEmpty && returnValue) - return true } } return returnValue @@ -428,6 +426,15 @@ class StructureParser(private val structure: AssistStructure) { } var passwordId: AutofillId? = null + set(value) { + if (field == null) { + field = value + } else { + confirmPasswordId = value + } + } + + var confirmPasswordId: AutofillId? = null set(value) { if (field == null) field = value @@ -483,6 +490,9 @@ class StructureParser(private val structure: AssistStructure) { passwordId?.let { all.add(it) } + confirmPasswordId?.let { + all.add(it) + } creditCardHolderId?.let { all.add(it) }