From 8d3b99652dff7234ff81ee318bda5c4ac86105c8 Mon Sep 17 00:00:00 2001 From: Noah Keller Date: Wed, 21 Jul 2021 15:52:40 -0400 Subject: [PATCH] Adds ability to resolve totp field by parent selector --- keepassxc-browser/content/totp-field.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/keepassxc-browser/content/totp-field.js b/keepassxc-browser/content/totp-field.js index 424aa3f..311a0db 100644 --- a/keepassxc-browser/content/totp-field.js +++ b/keepassxc-browser/content/totp-field.js @@ -18,6 +18,10 @@ const acceptedOTPFields = [ 'twofactor' ]; +const acceptedParents = [ + '.mfa-verify', +]; + var kpxcTOTPIcons = {}; kpxcTOTPIcons.icons = []; @@ -42,7 +46,7 @@ kpxcTOTPIcons.isAcceptedTOTPField = function(field) { // Checks if the field id, name or placeholder includes some of the acceptedOTPFields but not any from ignoredTypes if (autocomplete === 'one-time-code' - || (acceptedOTPFields.some(f => (id && id.includes(f)) || (name && name.includes(f) || placeholder && placeholder.includes(f)))) + || (acceptedOTPFields.some(f => (id && id.includes(f)) || (name && name.includes(f) || placeholder && placeholder.includes(f))) || acceptedParents.some(s => field.closest(s))) && !ignoredTypes.some(f => (id && id.includes(f)) || (name && name.includes(f) || placeholder && placeholder.includes(f)))) { return true; }