From c57cb92f3e590ee6f6c5955ecd25a180a040542b Mon Sep 17 00:00:00 2001 From: varjolintu Date: Mon, 15 Nov 2021 20:58:40 +0200 Subject: Add Twitter to Predefined Sites --- keepassxc-browser/common/sites.js | 22 +++++++++++++++++++++- keepassxc-browser/content/totp-field.js | 4 ++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/keepassxc-browser/common/sites.js b/keepassxc-browser/common/sites.js index 241c2fd..0037501 100644 --- a/keepassxc-browser/common/sites.js +++ b/keepassxc-browser/common/sites.js @@ -55,7 +55,8 @@ const PREDEFINED_SITELIST = [ 'https://signin.ebay.ph/*', 'https://login.yahoo.com/*', 'https://id.atlassian.com/*', - 'https://www.fidelity.com/*' + 'https://www.fidelity.com/*', + 'https://twitter.com/i/flow/login' ]; const kpxcSites = {}; @@ -97,6 +98,25 @@ kpxcSites.exceptionFound = function(identifier) { return false; }; +/** + * Handles a few exceptions for certain sites where 2FA field is not regognized properly. + * @param {object} field Input field Element + * @returns {boolean} True if an Element has a match with the needed indentfifiers and document location + */ +kpxcSites.totpExceptionFound = function(field) { + if (!field || field.nodeName !== 'INPUT') { + return false; + } + + if (document.location.href === 'https://twitter.com/i/flow/login' + && field.autocomplete === 'on' && field.dir === 'auto' + && field.name === 'text' && field.type === 'text') { + return true; + } + + return false; +}; + kpxcSites.expectedTOTPMaxLength = function() { if (document.location.origin.startsWith('https://www.amazon') && document.location.href.includes('/ap/mfa')) { diff --git a/keepassxc-browser/content/totp-field.js b/keepassxc-browser/content/totp-field.js index 0d15dde..9dbb1ec 100644 --- a/keepassxc-browser/content/totp-field.js +++ b/keepassxc-browser/content/totp-field.js @@ -52,6 +52,10 @@ kpxcTOTPIcons.isAcceptedTOTPField = function(field) { return true; } + if (kpxcSites.totpExceptionFound(field)) { + return true; + } + return false; }; -- cgit v1.2.3