diff --git a/keepassxc-browser/background/browserAction.js b/keepassxc-browser/background/browserAction.js index de1efc6..21f1abf 100755 --- a/keepassxc-browser/background/browserAction.js +++ b/keepassxc-browser/background/browserAction.js @@ -205,10 +205,10 @@ browserAction.setRememberPopup = function(tabId, username, password, url, userna browser.storage.local.get({'settings': {}}).then(function(item) { const settings = item.settings; - // Don't show anything if the site is in the ignore list - if (settings.ignoredSites !== undefined) { - for (const site of settings.ignoredSites) { - if (siteMatch(site.url, url)) { + // Don't show anything if the site is in the ignore + if (settings.sitePreferences !== undefined) { + for (const site of settings.sitePreferences) { + if (site.ignore === IGNORE_NORMAL && (site.url === url || siteMatch(site.url, url))) { return; } } diff --git a/keepassxc-browser/global.js b/keepassxc-browser/global.js index 8fe6432..8e1d970 100755 --- a/keepassxc-browser/global.js +++ b/keepassxc-browser/global.js @@ -1,5 +1,9 @@ 'use strict'; +const IGNORE_NOTHING = 'ignoreNothing'; +const IGNORE_NORMAL = 'ignoreNormal'; +const IGNORE_FULL = 'ignoreFull'; + var isFirefox = function() { if (!(/Chrome/.test(navigator.userAgent) && /Google/.test(navigator.vendor))) { return true; diff --git a/keepassxc-browser/keepassxc-browser.js b/keepassxc-browser/keepassxc-browser.js index 75cb90b..3d90c51 100755 --- a/keepassxc-browser/keepassxc-browser.js +++ b/keepassxc-browser/keepassxc-browser.js @@ -1424,12 +1424,16 @@ cip.initCredentialFields = function(forceCall) { browser.runtime.sendMessage({ 'action': 'page_clear_logins', args: [_called.clearLogins] }).then(() => { _called.clearLogins = true; - // Ignore sites with full ignore - cip.initializeIgnoredSites(); - if (cip.settings.ignoredSites) { - for (const site of cip.settings.ignoredSites) { - if (site.fullIgnore && siteMatch(site.url, document.location.href)) { - return; + // Check site preferences + cip.initializeSitePreferences(); + if (cip.settings.sitePreferences) { + for (const site of cip.settings.sitePreferences) { + if (site.url === document.location.href || siteMatch(site.url, document.location.href)) { + if (site.ignore === IGNORE_FULL) { + return; + } + + _singleInputEnabledForPage = site.usernameOnly; } } } @@ -1470,6 +1474,8 @@ cip.initCredentialFields = function(forceCall) { }).then(cip.retrieveCredentialsCallback).catch((e) => { console.log(e); }); + } else if (_singleInputEnabledForPage) { + cip.preparePageForMultipleCredentials(cip.credentials); } }); }; @@ -2049,13 +2055,25 @@ cip.ignoreSite = function(sites) { return; } - cip.initializeIgnoredSites(); - const site = sites[0]; - cip.settings['ignoredSites'].push({ - url: site, - fullIgnore: false - }); + cip.initializeSitePreferences(); + + // Check if the site already exists + let siteExists = false; + for (const existingSite of cip.settings['sitePreferences']) { + if (existingSite.url === site) { + existingSite.ignore = IGNORE_NORMAL; + siteExists = true; + } + } + + if (!siteExists) { + cip.settings['sitePreferences'].push({ + url: site, + ignore: IGNORE_NORMAL, + usernameOnly: false + }); + } browser.runtime.sendMessage({ action: 'save_settings', @@ -2064,13 +2082,13 @@ cip.ignoreSite = function(sites) { }; // Delete previously created Object if it exists. It will be replaced by an Array -cip.initializeIgnoredSites = function() { - if (cip.settings['ignoredSites'] !== undefined && cip.settings['ignoredSites'].constructor === Object) { - delete cip.settings['ignoredSites']; +cip.initializeSitePreferences = function() { + if (cip.settings['sitePreferences'] !== undefined && cip.settings['sitePreferences'].constructor === Object) { + delete cip.settings['sitePreferences']; } - if (!cip.settings['ignoredSites']) { - cip.settings['ignoredSites'] = []; + if (!cip.settings['sitePreferences']) { + cip.settings['sitePreferences'] = []; } }; diff --git a/keepassxc-browser/options/options.css b/keepassxc-browser/options/options.css index 5af1947..92d3b63 100644 --- a/keepassxc-browser/options/options.css +++ b/keepassxc-browser/options/options.css @@ -115,7 +115,7 @@ h2+hr { margin-right: 5px; } -#ignoreUrl { +#manualUrl { width: 75%; } diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index df2cd4b..397f946 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -20,14 +20,14 @@
  • General
  • Connected Databases
  • Custom credential fields
  • -
  • Ignored sites
  • +
  • Site preferences
  • About
  • -

    General Settings

    +

    General settings


    If you just want to insert username + password into the fields where your focus is, press Ctrl + Shift + UAlt + Shift + U. @@ -189,7 +189,7 @@

    -

    Connected Databases

    +

    Connected databases


    The following KeePassXC databases are connected to KeePassXC-Browser. @@ -289,24 +289,26 @@

    - -
    -

    Ignored sites

    + +
    +

    Site preferences


    - Sites in this list are ignored when new credentials are detected. + Sites on this page have special handling methods associated with them.
    - Go to the page with new credentials, click the blinking KeePassXC-Browser icon or the notification and select Never ask for this page. + To ignore new/modified credentials on a specific site, add it below or click the blinking KeePassXC-Browser icon and select Never ask for this page.
    - If full ignore is enabled, no input fields are detected and no credentials are received for that site. + If a site is fully ignored (Disable all features is selected), then the plugin will do nothing when visiting that site. +
    + Enabling the Username-Only Detection feature allows KeePassXC-Browser to fill-in pages on sites that do present a separated username and password input.


    - +
    - - + +
    @@ -315,22 +317,30 @@ Page URL + Ignore + Username-Only Detection Delete - Full ignore - No ignored sites found. + No sites found. + + + + - -