diff --git a/extension_mv3/content_scripts/cip.js b/extension_mv3/content_scripts/cip.js index b8917cb..ed2d4cc 100644 --- a/extension_mv3/content_scripts/cip.js +++ b/extension_mv3/content_scripts/cip.js @@ -91,7 +91,7 @@ var cip = { chrome.runtime.sendMessage({ 'action': 'retrieve_credentials', - 'args': [cip.url, cip.submitUrl, true, true] + 'args': [cip.url, cip.submitUrl, true, true, mcCombs.forceFilling] }, cip.retrieveCredentialsCallback); }, fillUserNameOrPasswordField: function() @@ -109,7 +109,7 @@ var cip = { chrome.runtime.sendMessage({ 'action': 'retrieve_credentials', - 'args': [document.location.origin, action, true, true] + 'args': [document.location.origin, action, true, true, mcCombs.forceFilling] }, mcCombs.retrieveCredentialsCallback); }, /** @@ -312,7 +312,7 @@ var cip = { chrome.runtime.sendMessage({ 'action': 'retrieve_credentials', - 'args': [cip.url, cip.submitUrl, true, true] + 'args': [cip.url, cip.submitUrl, true, true, false] }, function (credentials) { cipDebug.log('cip.fillInCredentials()'); cip.retrieveCredentialsCallback(credentials, true); @@ -337,8 +337,8 @@ var cip = { */ retrieveAndFillUserAndPassword: function () { + mcCombs.forceFilling = true; cip.initCredentialFields(true); - mcCombs.forceFilling = true; }, /** diff --git a/extension_mv3/vendor/mooltipass/device.js b/extension_mv3/vendor/mooltipass/device.js index 8bc6a54..872c65f 100644 --- a/extension_mv3/vendor/mooltipass/device.js +++ b/extension_mv3/vendor/mooltipass/device.js @@ -684,7 +684,7 @@ mooltipass.device.onTabUpdated = function(tabId, removeInfo) * @param forceCallback * @param triggerUnlock */ -mooltipass.device.retrieveCredentials = function(callback, tab, url, submiturl, forceCallback, triggerUnlock) +mooltipass.device.retrieveCredentials = function(callback, tab, url, submiturl, forceCallback, triggerUnlock, manualFilling) { if (background_debug_msg > 3) mpDebug.log('%c device: %c retrieveCredentials ','background-color: #e244ff','color: #484848', arguments); @@ -733,13 +733,16 @@ mooltipass.device.retrieveCredentials = function(callback, tab, url, submiturl, return; } } - if (mooltipass.device.checkInLastCredentialsRequests(tab.id, submiturl)){ - mooltipass.device.addToLastCredentialsRequests(tab.id, submiturl); - return; + + if (!manualFilling){ + if (mooltipass.device.checkInLastCredentialsRequests(tab.id, submiturl)){ + mooltipass.device.addToLastCredentialsRequests(tab.id, submiturl); + return; + } + + mooltipass.device.addToLastCredentialsRequests(tab.id, submiturl); } - - mooltipass.device.addToLastCredentialsRequests(tab.id, submiturl); - + // If our retrieveCredentialsQueue is empty and the device is unlocked, send the request to the app. Otherwise, queue it mooltipass.device.retrieveCredentialsQueue.push({'tabid': tab.id, 'callback': callback, 'domain': parsed_url.domain, 'subdomain': parsed_url.subdomain, 'tabupdated': false, 'reqid': mooltipass.device.retrieveCredentialsCounter, 'tab': tab}); diff --git a/extension_mv3/vendor/mooltipass/mcCombinations.js b/extension_mv3/vendor/mooltipass/mcCombinations.js index e21f0e2..6c8c655 100644 --- a/extension_mv3/vendor/mooltipass/mcCombinations.js +++ b/extension_mv3/vendor/mooltipass/mcCombinations.js @@ -64,16 +64,16 @@ var extendedCombinations = { currentForm.combination.fields.username = mpJQ('input[id=login-email]'); currentForm.combination.autoSubmit = true; } - if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ + if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ if (mpJQ('form#login-form input[name=login]').length > 0) { currentForm.combination.fields.username = mpJQ('form#login-form input[name=login]'); currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login-email"); - } - } + } + } } } - }, + }, hp: function (forms) { //console.log('hp combination'); if (mcCombs.getAllForms() == 0) return; @@ -319,8 +319,8 @@ var extendedCombinations = { if (buttonLoginNext){ currentForm.combination.submitLoginButton = buttonLoginNext; } - } - + } + //detectin submit password button for current combination //#passwordNext let divPasswordNext = document.querySelector('#passwordNext'); if (divPasswordNext){ @@ -331,7 +331,7 @@ var extendedCombinations = { } if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ - + var parentForm = currentForm.combination.fields.password[0].closest('form'); if (parentForm){ let inputEmail = parentForm.querySelector('input#identifierId'); @@ -341,7 +341,7 @@ var extendedCombinations = { currentForm.combination.fields.username.attr('data-mp-id', "identifierId"); if (!currentForm.element){ currentForm.element = mpJQ(parentForm); - } + } } } else { let inputEmail = document.querySelector('input#identifierId'); @@ -352,8 +352,8 @@ var extendedCombinations = { if (!currentForm.element){ currentForm.element = currentForm.combination.fields.username.parent(); } - } - } + } + } } //} } @@ -386,7 +386,7 @@ var extendedCombinations = { currentForm.combination.fields.username = mpJQ('input[type=email]'); currentForm.combination.autoSubmit = true; } - + if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ var parentForm = currentForm.combination.fields.password[0].closest('form'); if (parentForm){ @@ -397,12 +397,12 @@ var extendedCombinations = { currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "identifierId"); } - } + } } } } - }, + }, samsara: function (forms) { if (mcCombs.getAllForms() == 0) return; for (form in forms) { @@ -421,29 +421,29 @@ var extendedCombinations = { autoSubmit: false } - if (mpJQ('input[type=password]:visible').length > 0) { + if (mpJQ('input[type=password]:visible').length > 0) { currentForm.combination.fields.password = mpJQ('input[type=password]'); currentForm.combination.autoSubmit = true; } - if (mpJQ('input[type=email]:visible').length > 0) { + if (mpJQ('input[type=email]:visible').length > 0) { currentForm.combination.fields.username = mpJQ('input[type=email]'); currentForm.combination.autoSubmit = true; } - + if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ var parentForm = currentForm.combination.fields.password[0].closest('form'); if (parentForm){ var inputEmail = parentForm.querySelector('input[type=email]'); if (inputEmail){ currentForm.combination.fields.username = mpJQ(inputEmail); - currentForm.combination.autoSubmit = true; + currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_email"); } - } - } + } + } } } - }, + }, confluent: function (forms) { if (mcCombs.getAllForms() == 0) return; for (form in forms) { @@ -462,26 +462,26 @@ var extendedCombinations = { autoSubmit: false } - if (mpJQ('input[type=password]:visible').length > 0) { + if (mpJQ('input[type=password]:visible').length > 0) { currentForm.combination.fields.password = mpJQ('input[type=password]'); currentForm.combination.autoSubmit = true; } - if (mpJQ('input[type=email]:visible').length > 0) { + if (mpJQ('input[type=email]:visible').length > 0) { currentForm.combination.fields.username = mpJQ('input[type=email]'); currentForm.combination.autoSubmit = true; } - + if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ var parentForm = currentForm.combination.fields.password[0].closest('form'); if (parentForm){ var inputEmail = parentForm.querySelector('input[type=email]'); if (inputEmail){ currentForm.combination.fields.username = mpJQ(inputEmail); - currentForm.combination.autoSubmit = true; + currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_email"); } - } - } + } + } } } }, @@ -503,11 +503,11 @@ var extendedCombinations = { autoSubmit: false } - if (mpJQ('input[id=password-input').length > 0) { + if (mpJQ('input[id=password-input').length > 0) { currentForm.combination.fields.password = mpJQ('input[id=password-input'); currentForm.combination.autoSubmit = true; } - if (mpJQ('input[id=pps-input]').length > 0) { + if (mpJQ('input[id=pps-input]').length > 0) { currentForm.combination.fields.username = mpJQ('input[id=pps-input]'); currentForm.combination.autoSubmit = true; } @@ -518,14 +518,14 @@ var extendedCombinations = { var inputEmail = parentForm.querySelector('input[id=pps-input]'); if (inputEmail){ currentForm.combination.fields.username = mpJQ(inputEmail); - currentForm.combination.autoSubmit = true; + currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_email"); } - } - } + } + } } } - }, + }, newegg: function (forms) { if (mcCombs.getAllForms() == 0) return; for (form in forms) { @@ -544,26 +544,26 @@ var extendedCombinations = { autoSubmit: false } - if (mpJQ('input[type=password]:visible').length > 0) { + if (mpJQ('input[type=password]:visible').length > 0) { currentForm.combination.fields.password = mpJQ('input[type=password]'); currentForm.combination.autoSubmit = true; } - if (mpJQ('input[type=email]:visible').length > 0) { + if (mpJQ('input[type=email]:visible').length > 0) { currentForm.combination.fields.username = mpJQ('input[type=email]'); currentForm.combination.autoSubmit = true; } - + if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ var parentForm = currentForm.combination.fields.password[0].closest('form'); if (parentForm){ var inputEmail = parentForm.querySelector('input[type=email]'); if (inputEmail){ currentForm.combination.fields.username = mpJQ(inputEmail); - currentForm.combination.autoSubmit = true; + currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_email"); } - } - } + } + } } } }, @@ -585,11 +585,11 @@ var extendedCombinations = { autoSubmit: false } - if (mpJQ('input[type=password]:visible').length > 0) { + if (mpJQ('input[type=password]:visible').length > 0) { currentForm.combination.fields.password = mpJQ('input[type=password]'); currentForm.combination.autoSubmit = true; } - if (mpJQ('input[type=email]:visible').length > 0) { + if (mpJQ('input[type=email]:visible').length > 0) { currentForm.combination.fields.username = mpJQ('input[type=email]'); currentForm.combination.autoSubmit = true; } @@ -600,11 +600,11 @@ var extendedCombinations = { var inputEmail = parentForm.querySelector('input[name=j_username]'); if (inputEmail){ currentForm.combination.fields.username = mpJQ(inputEmail); - currentForm.combination.autoSubmit = true; + currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_email"); } - } - } + } + } } } }, @@ -626,11 +626,11 @@ var extendedCombinations = { autoSubmit: false } - if (mpJQ('input[type=password]:visible').length > 0) { + if (mpJQ('input[type=password]:visible').length > 0) { currentForm.combination.fields.password = mpJQ('input[type=password]'); currentForm.combination.autoSubmit = true; } - if (mpJQ('input[id=username]:visible').length > 0) { + if (mpJQ('input[id=username]:visible').length > 0) { currentForm.combination.fields.username = mpJQ('input[id=username]'); currentForm.combination.autoSubmit = true; } @@ -641,11 +641,11 @@ var extendedCombinations = { var inputEmail = parentForm.querySelector('input[name=username]'); if (inputEmail){ currentForm.combination.fields.username = mpJQ(inputEmail); - currentForm.combination.autoSubmit = true; + currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_email"); } - } - } + } + } } } }, @@ -667,11 +667,11 @@ var extendedCombinations = { autoSubmit: false } - if (mpJQ('input[id=password]:visible').length > 0) { + if (mpJQ('input[id=password]:visible').length > 0) { currentForm.combination.fields.password = mpJQ('input[id=password]'); currentForm.combination.autoSubmit = true; } - if (mpJQ('input[id=username]:visible').length > 0) { + if (mpJQ('input[id=username]:visible').length > 0) { currentForm.combination.fields.username = mpJQ('input[id=username]'); currentForm.combination.autoSubmit = true; } @@ -682,14 +682,14 @@ var extendedCombinations = { var inputEmail = parentForm.querySelector('input[name=username]'); if (inputEmail){ currentForm.combination.fields.username = mpJQ(inputEmail); - currentForm.combination.autoSubmit = true; + currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_email"); } - } - } + } + } } } - }, + }, firefox: function (forms) { if (mcCombs.getAllForms() == 0) return; for (form in forms) { @@ -708,29 +708,29 @@ var extendedCombinations = { autoSubmit: false } - if (mpJQ('input[type=password]:visible').length > 0) { + if (mpJQ('input[type=password]:visible').length > 0) { currentForm.combination.fields.password = mpJQ('input[type=password]'); currentForm.combination.autoSubmit = true; } - if (mpJQ('input[type=email]:visible').length > 0) { + if (mpJQ('input[type=email]:visible').length > 0) { currentForm.combination.fields.username = mpJQ('input[type=email]'); currentForm.combination.autoSubmit = true; } - + if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ var parentForm = currentForm.combination.fields.password[0].closest('form'); if (parentForm){ var inputEmail = parentForm.querySelector('input[type=email]'); if (inputEmail){ currentForm.combination.fields.username = mpJQ(inputEmail); - currentForm.combination.autoSubmit = true; + currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_email"); } - } - } + } + } } } - }, + }, meraki: function (forms) { if (mcCombs.getAllForms() == 0) return; for (form in forms) { @@ -749,29 +749,29 @@ var extendedCombinations = { autoSubmit: false } - if (mpJQ('input[data-testid=login_password]:visible').length > 0) { + if (mpJQ('input[data-testid=login_password]:visible').length > 0) { currentForm.combination.fields.password = mpJQ('input[data-testid=login_password]'); currentForm.combination.autoSubmit = true; } - if (mpJQ('input[data-testid=login_email]:visible').length > 0) { + if (mpJQ('input[data-testid=login_email]:visible').length > 0) { currentForm.combination.fields.username = mpJQ('input[data-testid=login_email]'); currentForm.combination.autoSubmit = true; } - + if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ var parentForm = currentForm.combination.fields.password[0].closest('form'); if (parentForm){ var inputEmail = parentForm.querySelector('input[data-testid=login_email]'); if (inputEmail){ currentForm.combination.fields.username = mpJQ(inputEmail); - currentForm.combination.autoSubmit = true; + currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_email"); } - } - } + } + } } } - }, + }, revolut: function (forms) { if (mcCombs.getAllForms() == 0) return; for (form in forms) { @@ -790,29 +790,29 @@ var extendedCombinations = { autoSubmit: false } - if (mpJQ('input[type=password]:visible').length > 0) { + if (mpJQ('input[type=password]:visible').length > 0) { currentForm.combination.fields.password = mpJQ('input[type=password]'); currentForm.combination.autoSubmit = true; } - if (mpJQ('input[type=email]:visible').length > 0) { + if (mpJQ('input[type=email]:visible').length > 0) { currentForm.combination.fields.username = mpJQ('input[type=email]'); currentForm.combination.autoSubmit = true; } - + if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ var parentForm = currentForm.combination.fields.password[0].closest('form'); if (parentForm){ var inputEmail = parentForm.querySelector('input[type=email]'); if (inputEmail){ currentForm.combination.fields.username = mpJQ(inputEmail); - currentForm.combination.autoSubmit = true; + currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_email"); } - } - } + } + } } } - }, + }, soundcloud: function (forms) { if (mcCombs.getAllForms() == 0) return; for (form in forms) { @@ -898,12 +898,12 @@ var extendedCombinations = { currentForm.combination.autoSubmit = true; } - if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ + if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ if (mpJQ('form#login input[type=text]').length > 0) { currentForm.combination.fields.username = mpJQ('form#login input[type=text]'); currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_username"); - } + } } } } @@ -986,7 +986,7 @@ var extendedCombinations = { password: '' }, autoSubmit: false - } + } if (mpJQ('input[id=resolving_input]:visible').length > 0) { // Step 1: Email currentForm.combination.fields.username = mpJQ('input[id=resolving_input]'); @@ -998,22 +998,22 @@ var extendedCombinations = { currentForm.combination.fields.password = mpJQ('input[id=password]'); currentForm.combination.autoSubmit = true; //STUB to allow our logic to work in this case - the input element not has a parent FORM - currentForm.element = mpJQ('div[id=resolver_container]'); + currentForm.element = mpJQ('div[id=resolver_container]'); } - if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ + if ((currentForm.combination.fields.password) && (!currentForm.combination.fields.username)){ var parentForm = currentForm.combination.fields.password[0].closest('#login_container'); if (parentForm){ var inputEmail = parentForm.querySelector('input[id="email"]'); if (inputEmail){ currentForm.combination.fields.username = mpJQ(inputEmail); - currentForm.combination.autoSubmit = true; + currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_email"); } - } - } - // } - } - } else { + } + } + // } + } + } else { for (form in forms) { var currentForm = forms[form]; if (currentForm.element) { // Skip noform form @@ -1044,13 +1044,13 @@ var extendedCombinations = { var inputEmail = parentForm.querySelector('input[type=email]'); if (inputEmail){ currentForm.combination.fields.username = mpJQ(inputEmail); - currentForm.combination.autoSubmit = true; + currentForm.combination.autoSubmit = true; currentForm.combination.fields.username.attr('data-mp-id', "login_email"); - + } - } - } - } + } + } + } } } }, @@ -1140,7 +1140,7 @@ var extendedPost = { /* / Form Detection by combinations. / Searches the DOM for a predefined set of combinations and retrieves credentials or prepares everything to be saved -/ This will, eventually, replace cip.* +/ This will, eventually, replace cip.* */ /* Debug Levels: @@ -1201,8 +1201,8 @@ mcCombinations.prototype.gotSettings = function (response) { if (this.callback) this.callback.apply(this, response); this.detectCombination(); document.addEventListener("contextmenu", function(event){ - clickedElement = event.target; - }, true); + clickedElement = event.target; + }, true); } else { if (this.settings.debugLevel > 0) cipDebug.warn('Get settings returned empty!', runtime.lastError); } @@ -1260,7 +1260,7 @@ mcCombinations.prototype.possibleCombinations = [ combinationName: 'microsoftonline Two Page Login Procedure', requiredUrl: 'login.microsoftonline.com', callback: extendedCombinations.microsoftonline - }, + }, { combinationId: 'samsaraTwoPageAuth', combinationName: 'Samsara Two Page Login Procedure', @@ -1278,7 +1278,7 @@ mcCombinations.prototype.possibleCombinations = [ combinationName: 'Ros Page Login Procedure', requiredUrl: 'ros.ie', callback: extendedCombinations.ros - }, + }, { combinationId: 'neweggTwoPageAuth', combinationName: 'Newegg Two Page Login Procedure', @@ -1302,25 +1302,25 @@ mcCombinations.prototype.possibleCombinations = [ combinationName: 'docker Two Page Login Procedure', requiredUrl: 'login.docker.com', callback: extendedCombinations.docker - }, + }, { combinationId: 'firefoxTwoPageAuth', combinationName: 'Firefox Two Page Login Procedure', requiredUrl: 'accounts.firefox.com', callback: extendedCombinations.firefox - }, + }, { combinationId: 'merakiTwoPageAuth', combinationName: 'Meraki Two Page Login Procedure', requiredUrl: 'meraki.com', callback: extendedCombinations.meraki - }, + }, { combinationId: 'revolutTwoPageAuth', combinationName: 'Revolut Two Page Login Procedure', requiredUrl: 'business.revolut.com', callback: extendedCombinations.revolut - }, + }, { combinationId: 'soundcloudTwoPageAuth', combinationName: 'SoundCloud Two Page Login Procedure', @@ -1362,7 +1362,7 @@ mcCombinations.prototype.possibleCombinations = [ combinationName: 'Box Login Procedure', requiredUrl: 'account.box.com', callback: extendedCombinations.box - }, + }, { combinationId: 'googleTwoPageAuth', combinationName: 'Google Two Page Login Procedure', @@ -1608,7 +1608,7 @@ mcCombinations.prototype.possibleCombinations = [ this.fields.username = r[0].Login; } }.bind(this); - messaging({ 'action': 'retrieve_credentials', 'args': [url, submitUrl, true, true] }); + messaging({ 'action': 'retrieve_credentials', 'args': [url, submitUrl, true, true, false] }); } }.bind(this); messaging({ 'action': 'cache_retrieve' }); @@ -1618,7 +1618,7 @@ mcCombinations.prototype.possibleCombinations = [ this.fields.password = this.fields.password.parents('form').find("input[type='password']:not('.mooltipass-password-do-not-update')"); // for( field in fields ) { - // fields[field].addClass('mooltipass-password-do-not-update'); + // fields[field].addClass('mooltipass-password-do-not-update'); // } // Use password generated for both new password fields @@ -1664,7 +1664,7 @@ mcCombinations.prototype.possibleCombinations = [ this.fields.username = r[0].Login; } }.bind(this); - messaging({ 'action': 'retrieve_credentials', 'args': [url, submitUrl, true, true] }); + messaging({ 'action': 'retrieve_credentials', 'args': [url, submitUrl, true, true, false] }); } }.bind(this); messaging({ 'action': 'cache_retrieve' }); @@ -1704,7 +1704,7 @@ mcCombinations.prototype.detectCombination = function () { } if (numberOfFields > 0) { - // Check for special cases first + // Check for special cases first for (var I = 0; I < this.possibleCombinations.length; I++) { var parsedUrl = psl.parse(window.location.hostname); if (this.possibleCombinations[I].requiredUrl && @@ -1735,7 +1735,7 @@ mcCombinations.prototype.detectCombination = function () { this.passwordFieldId = currentForm.combination.fields.password && currentForm.combination.fields.password.data('mp-id') - + let submitButton = null; if (currentForm.combination.submitButton){ submitButton = currentForm.combination.submitButton; @@ -1775,7 +1775,7 @@ mcCombinations.prototype.detectCombination = function () { if (submitUrl.indexOf("login.microsoftonline.com") > -1){ submitUrl = submitUrl.replace("login.microsoftonline.com", "live.com"); } - messaging({ 'action': 'retrieve_credentials', 'args': [url, submitUrl, true, true] }); + messaging({ 'action': 'retrieve_credentials', 'args': [url, submitUrl, true, true, false] }); } this.waitingForPost = true; @@ -1797,7 +1797,7 @@ mcCombinations.prototype.detectCombination = function () { if (this.credentialsCache && this.credentialsCache.length > 0) { if (iFillFromCacheCount < 2){ - iFillFromCacheCount = iFillFromCacheCount + 1; + iFillFromCacheCount = iFillFromCacheCount + 1; // Sometimes the form changes when typing in. Issuing a new detectCombination.. we use a temporary cache to avoid double request in the device if (this.settings.debugLevel > 1) cipDebug.log('%c mcCombinations - %c Using credentials from cache', 'background-color: #c3c6b4', 'color: #777777', currentForm.element); this.retrieveCredentialsCallback(this.credentialsCache); @@ -1806,7 +1806,7 @@ mcCombinations.prototype.detectCombination = function () { } } else { if (this.settings.debugLevel > 1) cipDebug.trace('%c mcCombinations - %c Retrieving credentials', 'background-color: #c3c6b4', 'color: #777777', currentForm.element); - messaging({ 'action': 'retrieve_credentials', 'args': [url, submitUrl, true, true] }); + messaging({ 'action': 'retrieve_credentials', 'args': [url, submitUrl, true, true, false] }); } } } @@ -2026,7 +2026,7 @@ mcCombinations.prototype.getAllForms = function () { // Ignore our fields and search fields. if (field.attr('id') == 'mooltipass-password-generator' || (field.attr('id') && field.attr('id').toLowerCase().includes("recherche")) || - (field.clone().children().remove().end()[0].outerHTML.match(/search/i)) || + (field.clone().children().remove().end()[0].outerHTML.match(/search/i)) || (field.clone().children().remove().end()[0].outerHTML.match(/newsletter/i))) { return; } @@ -2084,7 +2084,7 @@ mcCombinations.prototype.onSubmit = function (event) { console.log("no password feild for accounts.google.com"); return; } - } + } if (this.settings.debugLevel > 1) cipDebug.log('%c mcCombinations: %c onSubmit', 'background-color: #c3c6b4', 'color: #333333'); this.waitingForPost = false; @@ -2276,8 +2276,9 @@ mcCombinations.prototype.retrieveCredentialsCallback = function (credentials) { } if (this.forceFilling && clickedElement){ + try { if (this.fillPasswordOnly){ - var passwordField = mpJQ(clickedElement); + var passwordField = mpJQ(clickedElement); passwordField.val(''); try { passwordField.click(); @@ -2291,10 +2292,11 @@ mcCombinations.prototype.retrieveCredentialsCallback = function (credentials) { passwordField[0].dispatchEvent(new Event('change')); //currentForm.combination.savedFields.password.value = credentials[0].Password; wasFilled = true; + return; } if (this.fillUserOnly){ if (credentials[0].Login) { - var loginField = mpJQ(clickedElement); + var loginField = mpJQ(clickedElement); loginField.val(''); loginField.click(); try { @@ -2303,24 +2305,32 @@ mcCombinations.prototype.retrieveCredentialsCallback = function (credentials) { } catch (e) {} loginField[0].dispatchEvent(new Event('change')); // currentForm.combination.savedFields.username.value = credentials[0].Login; - } + return; + } } if (credentials.totpcode){ - var fieldForTOTP = mpJQ(clickedElement); + var fieldForTOTP = mpJQ(clickedElement); fieldForTOTP.val(''); fieldForTOTP.click(); try { fieldForTOTP.sendkeys(credentials.totpcode); this.triggerChangeEvent(fieldForTOTP[0], credentials.totpcode); - fieldForTOTP.trigger('blur'); + fieldForTOTP.trigger('blur'); } catch (e) {} - fieldForTOTP[0].dispatchEvent(new Event('change')); + fieldForTOTP[0].dispatchEvent(new Event('change')); + return; + } + + } finally { + this.fillUserOnly = false; + this.fillPasswordOnly = false; + this.forceFilling = false; } - } - else { + } + for (form in this.forms) { - + var wasFilled = false; currentForm = this.forms[form]; if (this.settings.debugLevel > 1) cipDebug.log('%c mcCombinations - %c retrieveCredentialsCallback filling form', 'background-color: #c3c6b4', 'color: #FF0000', currentForm); @@ -2348,7 +2358,7 @@ mcCombinations.prototype.retrieveCredentialsCallback = function (credentials) { wasFilled = true; } } - + if (credentials[0].Password && currentForm.combination.fields.password && (currentForm.combination.combinationId != 'passwordreset001XX')) { if (this.settings.debugLevel > 3) cipDebug.log('%c mcCombinations - %c retrieveCredentialsCallback filling form - Password', 'background-color: #c3c6b4', 'color: #FF0000'); // Fill-in Password @@ -2405,8 +2415,7 @@ mcCombinations.prototype.retrieveCredentialsCallback = function (credentials) { // Don't proceed other forms when we have defined credential fields. if (this.forms['noform'].definedCredentialFields) break } - } - + this.fillUserOnly = false; this.fillPasswordOnly = false; this.forceFilling = false; @@ -2452,7 +2461,7 @@ mcCombinations.prototype.detectSubmitButton = function detectSubmitButton(field, /reset/i, /registration/i, /register/i, - /edit/i, + /edit/i, /oubliƩ/i, /vergeten/i, /problemen/i, @@ -2505,7 +2514,7 @@ mcCombinations.prototype.detectSubmitButton = function detectSubmitButton(field, var buttonOuterHTML = mpJQ(button).clone().children().remove().end()[0].outerHTML; if ((!window.location.hostname.match(/nextcloud.com/)) && (!window.location.hostname.match(/mpiphp.org/))) { for (var i = 0; i < IGNORE_PATTERNS.length; i++) { - if (buttonOuterHTML.match(IGNORE_PATTERNS[i])) { + if (buttonOuterHTML.match(IGNORE_PATTERNS[i])) { return false } } @@ -2529,7 +2538,7 @@ mcCombinations.prototype.detectSubmitButton = function detectSubmitButton(field, if (a.distance == b.distance) return 0 }) - // Button shouldn't be far more than 240px (old-150px old2-210px) from input. + // Button shouldn't be far more than 240px (old-150px old2-210px) from input. if (buttons.length > 0) { // Check if button was previously selected @@ -2623,12 +2632,12 @@ mcCombinations.prototype.doSubmit = function doSubmit(currentForm) { return } if (window.location.hostname.match(/accounts.google.com/)) { //for google trigger('submit') not works. So, simulate the pressing of the ENTER key - var ke1 = new KeyboardEvent('keydown', {bubbles: true, cancelable: true, keyCode: 13}); + var ke1 = new KeyboardEvent('keydown', {bubbles: true, cancelable: true, keyCode: 13}); if (field){ - field[0].dispatchEvent(ke1); - } + field[0].dispatchEvent(ke1); + } return - } + } if (!mpJQ(currentForm.element)[0].outerHTML.match(/ng-submit/i)) mpJQ(currentForm.element).trigger('submit'); } } @@ -2682,7 +2691,7 @@ mcCombinations.prototype.postDetected = function (details) { if ((inputpass) && (inputpass.value.length > 7)){ //google password 8 characters or more if ((details.requestBody.formData['f.req'].length > 0) && (details.requestBody.formData['f.req'][0].indexOf(inputpass.value) > -1)){ this.onSubmit.call(this, { target: inputpass.closest('form') }); - return; + return; } } }