From 5fb26390d8a8c27c5c4fec2e7918d24a936b72fe Mon Sep 17 00:00:00 2001 From: varjolintu Date: Tue, 6 Mar 2018 23:38:39 +0200 Subject: [PATCH 01/22] Remove alert and show autocomplete instead --- keepassxc-browser/keepassxc-browser.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/keepassxc-browser/keepassxc-browser.js b/keepassxc-browser/keepassxc-browser.js index 88c7064..7a4d06b 100755 --- a/keepassxc-browser/keepassxc-browser.js +++ b/keepassxc-browser/keepassxc-browser.js @@ -1656,12 +1656,10 @@ cip.fillIn = function(combination, onlyPassword, suppressWarnings) { // user has to select correct credentials by himself if (countPasswords > 1) { if (!suppressWarnings) { - const message = 'Error #105\nMore than one login was found in KeePassXC!\n' + - 'Press the KeePassXC-Browser icon for more options.'; - browser.runtime.sendMessage({ - action: 'alert', - args: [message] - }); + const $target = onlyPassword ? pField : uField; + cipAutocomplete.init($target); + $target.focus(); + jQuery($target).autocomplete('search', jQuery($target).val()); } } else if (countPasswords < 1) { @@ -1676,12 +1674,10 @@ cip.fillIn = function(combination, onlyPassword, suppressWarnings) { } else { if (!suppressWarnings) { - const message = 'Error #104\nMore than one login was found in KeePassXC!\n' + - 'Press the KeePassXC-Browser icon for more options.'; - browser.runtime.sendMessage({ - action: 'alert', - args: [message] - }); + const $target = onlyPassword ? pField : uField; + cipAutocomplete.init($target); + $target.focus(); + jQuery($target).autocomplete('search', jQuery($target).val()); } } } From 7cd4e3085a607f7f9005624b08a5de406a7f641a Mon Sep 17 00:00:00 2001 From: varjolintu Date: Wed, 7 Mar 2018 06:52:18 +0200 Subject: [PATCH 02/22] Switch from alerts to notifications --- keepassxc-browser/background/event.js | 9 ++++--- keepassxc-browser/keepassxc-browser.js | 34 ++++++++++++++++---------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/keepassxc-browser/background/event.js b/keepassxc-browser/background/event.js index c730af6..e4fe61e 100755 --- a/keepassxc-browser/background/event.js +++ b/keepassxc-browser/background/event.js @@ -75,9 +75,10 @@ kpxcEvent.invoke = function(handler, callback, senderTabId, args, secondTime) { }).catch((e) => {console.log(e);}); }; -kpxcEvent.onShowAlert = function(callback, tab, message) { - if (page.settings.supressAlerts) { console.log(message); } - else { alert(message); } +kpxcEvent.onShowNotification = function(callback, tab, message) { + if (page.settings.showNotifications) { + showNotification(message); + } }; kpxcEvent.showStatus = function(configured, tab, callback) { @@ -274,7 +275,6 @@ kpxcEvent.checkDatabaseHash = function(callback, tab) { // all methods named in this object have to be declared BEFORE this! kpxcEvent.messageHandlers = { 'add_credentials': keepass.addCredentials, - 'alert': kpxcEvent.onShowAlert, 'associate': keepass.associate, 'check_databasehash': kpxcEvent.checkDatabaseHash, 'check_update_keepassxc': kpxcEvent.onCheckUpdateKeePassXC, @@ -298,6 +298,7 @@ kpxcEvent.messageHandlers = { 'update_credentials': keepass.updateCredentials, 'save_settings': kpxcEvent.onSaveSettings, 'set_remember_credentials': kpxcEvent.onSetRememberPopup, + 'show_notification': kpxcEvent.onShowNotification, 'stack_add': browserAction.stackAdd, 'update_available_keepassxc': kpxcEvent.onUpdateAvailableKeePassXC }; diff --git a/keepassxc-browser/keepassxc-browser.js b/keepassxc-browser/keepassxc-browser.js index 7a4d06b..5fe3554 100755 --- a/keepassxc-browser/keepassxc-browser.js +++ b/keepassxc-browser/keepassxc-browser.js @@ -305,7 +305,11 @@ cipPassword.createDialog = function() { $password = $password.substring(0, field.attr('maxlength')); jQuery('input#cip-genpw-textfield-password:first').val($password); jQuery('#cip-genpw-btn-clipboard:first').removeClass('b2c-btn-success'); - alert('The generated password is longer than the allowed length!\nIt has been cut to fit the length.\n\nPlease remember the new password!'); + const message = 'Error:\nThe generated password is longer than the allowed length!\nIt has been cut to fit the length.\n\nPlease remember the new password!'; + browser.runtime.sendMessage({ + action: 'show_notification', + args: [message] + }); } } @@ -1455,9 +1459,9 @@ cip.fillInFromActiveElement = function(suppressWarnings, passOnly = false) { if (passOnly) { if (!_f(combination.password)) { - const message = 'Unable to find a password field'; + const message = 'Error:\nUnable to find a password field'; browser.runtime.sendMessage({ - action: 'alert', + action: 'show_notification', args: [message] }); return; @@ -1539,9 +1543,9 @@ cip.setValueWithChange = function(field, value) { cip.fillIn = function(combination, onlyPassword, suppressWarnings) { // no credentials available if (cip.credentials.length === 0 && !suppressWarnings) { - const message = 'No logins found.'; + const message = 'Error:\nNo logins found.'; browser.runtime.sendMessage({ - action: 'alert', + action: 'show_notification', args: [message] }); return; @@ -1572,9 +1576,9 @@ cip.fillIn = function(combination, onlyPassword, suppressWarnings) { if (!filledIn) { if (!suppressWarnings) { - const message = 'Error #101\nCannot find fields to fill in.'; + const message = 'Error:\nCannot find fields to fill in.'; browser.runtime.sendMessage({ - action: 'alert', + action: 'show_notification', args: [message] }); } @@ -1602,9 +1606,9 @@ cip.fillIn = function(combination, onlyPassword, suppressWarnings) { if (!filledIn) { if (!suppressWarnings) { - const message = 'Error #102\nCannot find fields to fill in.'; + const message = 'Error:\nCannot find fields to fill in.'; browser.runtime.sendMessage({ - action: 'alert', + action: 'show_notification', args: [message] }); } @@ -1631,7 +1635,7 @@ cip.fillIn = function(combination, onlyPassword, suppressWarnings) { } } - // for the correct alert message: 0 = no logins, X > 1 = too many logins + // for the correct notification message: 0 = no logins, X > 1 = too many logins if (countPasswords === 0) { countPasswords = cip.credentials.length; } @@ -1664,9 +1668,9 @@ cip.fillIn = function(combination, onlyPassword, suppressWarnings) { } else if (countPasswords < 1) { if (!suppressWarnings) { - const message = 'Error #103\nNo credentials for given username found.'; + const message = 'Error:\nNo credentials for given username found.'; browser.runtime.sendMessage({ - action: 'alert', + action: 'show_notification', args: [message] }); } @@ -1713,7 +1717,11 @@ cip.contextMenuRememberCredentials = function() { } if (!cip.rememberCredentials(usernameValue, passwordValue)) { - alert('Could not detect changed credentials.'); + const message = 'Error:\nCould not detect changed credentials.'; + browser.runtime.sendMessage({ + action: 'show_notification', + args: [message] + }); } }; From 5d77966605d703f0548ad2fab6081ae6ae80a56f Mon Sep 17 00:00:00 2001 From: varjolintu Date: Thu, 8 Mar 2018 17:16:39 +0200 Subject: [PATCH 03/22] Fix listener leaking --- keepassxc-browser/keepassxc-browser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keepassxc-browser/keepassxc-browser.js b/keepassxc-browser/keepassxc-browser.js index 88c7064..2f8c2c3 100755 --- a/keepassxc-browser/keepassxc-browser.js +++ b/keepassxc-browser/keepassxc-browser.js @@ -1172,7 +1172,7 @@ cip.detectDatabaseChange = function() { browser.runtime.sendMessage({ action: 'check_databasehash' }).then((response) => { - if (response.new === 'no-hash') { + if (response.new === 'no-hash' && response.old !== 'no-hash') { cipEvents.clearCredentials(); browser.runtime.sendMessage({ From 1aa0e5567d2185f57fccd936b13d1bf3cea30a34 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Wed, 7 Mar 2018 07:04:26 +0200 Subject: [PATCH 04/22] Add a new option showLoginNotifications --- keepassxc-browser/background/browserAction.js | 2 +- keepassxc-browser/background/page.js | 6 +++++- keepassxc-browser/options/options.html | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/keepassxc-browser/background/browserAction.js b/keepassxc-browser/background/browserAction.js index 7b72292..d2fdb7d 100755 --- a/keepassxc-browser/background/browserAction.js +++ b/keepassxc-browser/background/browserAction.js @@ -239,7 +239,7 @@ browserAction.setRememberPopup = function(tabId, username, password, url, userna browserAction.show(null, {'id': id}); - if (page.settings.showNotifications) { + if (page.settings.showLoginNotifications) { showNotification('Create or modify the credentials by clicking on the extension icon.'); } }); diff --git a/keepassxc-browser/background/page.js b/keepassxc-browser/background/page.js index f82b2ea..ab7bd27 100755 --- a/keepassxc-browser/background/page.js +++ b/keepassxc-browser/background/page.js @@ -5,7 +5,8 @@ const defaultSettings = { usePasswordGenerator: true, autoFillSingleEntry: false, autoRetrieveCredentials: true, - showNotifications: true + showNotifications: true, + showLoginNotifications: true }; var page = {}; @@ -38,6 +39,9 @@ page.initSettings = function() { if (!('showNotifications' in page.settings)) { page.settings.showNotifications = defaultSettings.showNotifications; } + if (!('showLoginNotifications' in page.settings)) { + page.settings.showLoginNotifications = defaultSettings.showLoginNotifications; + } browser.storage.local.set({'settings': page.settings}); resolve(page.settings); }); diff --git a/keepassxc-browser/options/options.html b/keepassxc-browser/options/options.html index 4184bee..55e060f 100644 --- a/keepassxc-browser/options/options.html +++ b/keepassxc-browser/options/options.html @@ -130,7 +130,12 @@ - Allow KeePassXC-Browser to show notifications when user interaction is needed from the extension icon. + Show notifications for errors and when user interaction is required. + +
+


From d210bd19cbc20a7cb8f0151ce5e576837004f7e7 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sun, 11 Mar 2018 21:31:27 -0400 Subject: [PATCH 05/22] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 941323e..b08c3ce 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,17 +1,19 @@ - ## Expected Behavior + ## Current Behavior + ## Possible Solution + ## Steps to Reproduce (for bugs) @@ -22,11 +24,9 @@ ## Debug info +KeePassXC - {VERSION} +keepassxc-browser - {VERSION} -## General Info -KeePassXC fork - VERSION -keepassxc-browser - VERSION - -Operating system: OS -Browser: BROWSER +Operating system: Mac/Win/Linux +Browser: Chrome/Firefox/Vivaldi/Chromium Proxy used: YES/NO From 5bac8aab2c93db34f794c669575753f95355102b Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sun, 11 Mar 2018 21:32:07 -0400 Subject: [PATCH 06/22] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index b08c3ce..4d3a457 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -25,8 +25,11 @@ ## Debug info KeePassXC - {VERSION} + keepassxc-browser - {VERSION} Operating system: Mac/Win/Linux + Browser: Chrome/Firefox/Vivaldi/Chromium + Proxy used: YES/NO From 7d631b5f9476c14f33f5ef9ab0c6c5b20d52e2b6 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Sun, 11 Mar 2018 21:32:39 -0400 Subject: [PATCH 07/22] Update ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 4d3a457..133d4cf 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -25,11 +25,7 @@ ## Debug info KeePassXC - {VERSION} - keepassxc-browser - {VERSION} - Operating system: Mac/Win/Linux - Browser: Chrome/Firefox/Vivaldi/Chromium - Proxy used: YES/NO From 89ef01c95ad3b8565facfad9712d43778e1c5d06 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Mon, 2 Apr 2018 13:43:18 +0300 Subject: [PATCH 08/22] Password generator fixes --- keepassxc-browser/keepassxc-browser.css | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/keepassxc-browser/keepassxc-browser.css b/keepassxc-browser/keepassxc-browser.css index 8871bad..f61efc0 100644 --- a/keepassxc-browser/keepassxc-browser.css +++ b/keepassxc-browser/keepassxc-browser.css @@ -60,7 +60,7 @@ input.genpw-text { font-size: inherit !important; background-color: #eee; border: 1px solid #ccc; - padding: .4em; + padding: .2em; border-radius: 4px; border-top-left-radius: 0; border-bottom-left-radius: 0; @@ -102,6 +102,10 @@ input.genpw-text { margin-right: 5px; } +#cip-genpw-quality { + text-align: center; +} + .b2c-modal-backdrop { position: fixed; top: 0; From 39b6b24f681fa2659e5275ffb28b487b00fdcd2b Mon Sep 17 00:00:00 2001 From: varjolintu Date: Mon, 2 Apr 2018 14:23:00 +0300 Subject: [PATCH 09/22] Hide all popup elements by default --- keepassxc-browser/popups/popup.html | 2 +- keepassxc-browser/popups/popup.js | 1 + keepassxc-browser/popups/popup_functions.js | 3 --- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/keepassxc-browser/popups/popup.html b/keepassxc-browser/popups/popup.html index 83340d8..fa1bd0c 100644 --- a/keepassxc-browser/popups/popup.html +++ b/keepassxc-browser/popups/popup.html @@ -18,7 +18,7 @@ -
+
+ +
+

Ignored sites

+
+

+ Sites in this list are ignored when new credentials are detected. +
+ Go to the page with new credentials, click the blinking KeePassXC-Browser icon or the notification and select Never ask for this page. +

+ + + + + + + + + + + + + + + + +
Page URLDelete
No ignored sites found.
+ +
+

About

diff --git a/keepassxc-browser/options/options.js b/keepassxc-browser/options/options.js index e7db3aa..dc53bcd 100644 --- a/keepassxc-browser/options/options.js +++ b/keepassxc-browser/options/options.js @@ -17,6 +17,7 @@ $(function() { options.initGeneralSettings(); options.initConnectedDatabases(); options.initSpecifiedCredentialFields(); + options.initIgnoredSites(); options.initAbout(); }); }); @@ -173,8 +174,7 @@ options.initConnectedDatabases = function() { if ($('#tab-connected-databases table tbody:first tr').length > 2) { $('#tab-connected-databases table tbody:first tr.empty:first').hide(); - } - else { + } else { $('#tab-connected-databases table tbody:first tr.empty:first').show(); } }); @@ -201,8 +201,7 @@ options.initConnectedDatabases = function() { if ($('#tab-connected-databases table tbody:first tr').length > 2) { $('#tab-connected-databases table tbody:first tr.empty:first').hide(); - } - else { + } else { $('#tab-connected-databases table tbody:first tr.empty:first').show(); } @@ -235,8 +234,7 @@ options.initSpecifiedCredentialFields = function() { if ($('#tab-specified-fields table tbody:first tr').length > 2) { $('#tab-specified-fields table tbody:first tr.empty:first').hide(); - } - else { + } else { $('#tab-specified-fields table tbody:first tr.empty:first').show(); } }); @@ -248,7 +246,7 @@ options.initSpecifiedCredentialFields = function() { const $tr = $trClone.clone(true); $tr.data('url', url); $tr.attr('id', 'tr-scf' + counter); - counter += 1; + ++counter; $tr.children('td:first').text(url); $('#tab-specified-fields table tbody:first').append($tr); @@ -256,12 +254,58 @@ options.initSpecifiedCredentialFields = function() { if ($('#tab-specified-fields table tbody:first tr').length > 2) { $('#tab-specified-fields table tbody:first tr.empty:first').hide(); - } - else { + } else { $('#tab-specified-fields table tbody:first tr.empty:first').show(); } }; +options.initIgnoredSites = function() { + $('#dialogDeleteIgnoredSite').modal({keyboard: true, show: false, backdrop: true}); + $('#tab-ignored-sites tr.clone:first button.delete:first').click(function(e) { + e.preventDefault(); + $('#dialogDeleteIgnoredSite').data('url', $(this).closest('tr').data('url')); + $('#dialogDeleteIgnoredSite').data('tr-id', $(this).closest('tr').attr('id')); + $('#dialogDeleteIgnoredSite .modal-body:first strong:first').text($(this).closest('tr').children('td:first').text()); + $('#dialogDeleteIgnoredSite').modal('show'); + }); + + $('#dialogDeleteIgnoredSite .modal-footer:first button.yes:first').click(function(e) { + $('#dialogDeleteIgnoredSite').modal('hide'); + + const $url = $('#dialogDeleteIgnoredSite').data('url'); + const $trId = $('#dialogDeleteIgnoredSite').data('tr-id'); + $('#tab-ignored-sites #' + $trId).remove(); + + delete options.settings['ignoredSites'][$url]; + options.saveSettings(); + + if ($('#tab-ignored-sites table tbody:first tr').length > 2) { + $('#tab-ignored-sites table tbody:first tr.empty:first').hide(); + } else { + $('#tab-ignored-sites table tbody:first tr.empty:first').show(); + } + }); + + const $trClone = $('#tab-ignored-sites table tr.clone:first').clone(true); + $trClone.removeClass('clone'); + let counter = 1; + for (let url in options.settings['ignoredSites']) { + const $tr = $trClone.clone(true); + $tr.data('url', url); + $tr.attr('id', 'tr-scf' + counter); + ++counter; + + $tr.children('td:first').text(url); + $('#tab-ignored-sites table tbody:first').append($tr); + } + + if ($('#tab-ignored-sites table tbody:first tr').length > 2) { + $('#tab-ignored-sites table tbody:first tr.empty:first').hide(); + } else { + $('#tab-ignored-sites table tbody:first tr.empty:first').show(); + } +}; + options.initAbout = function() { $('#tab-about em.versionCIP').text(browser.runtime.getManifest().version); if (isFirefox()) { diff --git a/keepassxc-browser/popups/popup_remember.html b/keepassxc-browser/popups/popup_remember.html index 86ad865..6d367b4 100644 --- a/keepassxc-browser/popups/popup_remember.html +++ b/keepassxc-browser/popups/popup_remember.html @@ -32,6 +32,7 @@ +

diff --git a/keepassxc-browser/popups/popup_remember.js b/keepassxc-browser/popups/popup_remember.js index be79328..5c0505a 100644 --- a/keepassxc-browser/popups/popup_remember.js +++ b/keepassxc-browser/popups/popup_remember.js @@ -78,6 +78,21 @@ function _initialize(tab) { e.preventDefault(); _close(); }); + + $('#btn-ignore').click(function(e) { + browser.windows.getCurrent().then((win) => { + browser.tabs.query({ 'active': true, 'currentWindow': true }).then((tabs) => { + const tab = tabs[0]; + browser.runtime.getBackgroundPage().then((global) => { + browser.tabs.sendMessage(tab.id, { + action: 'ignore-site', + args: [_tab.credentials.url] + }); + _close(); + }); + }); + }); + }); } function _connected_database(db) { From 4391e90b87a0431251955247828932ee092d4bb1 Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Wed, 9 May 2018 21:31:10 +0200 Subject: [PATCH 21/22] Version 1.1.0 --- CHANGELOG | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 12e6727..a02ad44 100755 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,15 @@ +1.1.0 (09-05-2018) +========================= +- Allow specifying ignored sites +- Add new notification options +- Improve detection of username fields +- Change conflicting shortcuts +- Redetect credential fields after reload +- Don't show popup when database is closed +- Various password generator fixes +- Fix various resource leaks +- Fix searching in all databases + 1.0.1 (04-03-2018) ========================= - Don't fill password fields if they already have data From a01109e345cf7087ad9f90c0e87ddef81435aa5d Mon Sep 17 00:00:00 2001 From: Janek Bevendorff Date: Wed, 9 May 2018 21:33:20 +0200 Subject: [PATCH 22/22] Update version in manifest --- keepassxc-browser/manifest.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/keepassxc-browser/manifest.json b/keepassxc-browser/manifest.json index f6e0b79..047606d 100755 --- a/keepassxc-browser/manifest.json +++ b/keepassxc-browser/manifest.json @@ -1,8 +1,8 @@ { "manifest_version": 2, "name": "KeePassXC-Browser", - "version": "1.0.1", - "version_name": "1.0.1", + "version": "1.1.0", + "version_name": "1.1.0", "description": "KeePassXC integration for modern web browsers", "author": "KeePassXC Team", "icons": {