mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #151 from keepassxreboot/save_domain_fix
Fix save domain only option
This commit is contained in:
commit
ef2d5ed3c9
1 changed files with 15 additions and 7 deletions
|
|
@ -632,7 +632,8 @@ cipDefine.initDescription = function() {
|
|||
fieldIds.push(cipFields.prepareId(i));
|
||||
}
|
||||
|
||||
cip.settings['defined-credential-fields'][document.location.href] = {
|
||||
const location = cip.getDocumentLocation();
|
||||
cip.settings['defined-credential-fields'][location] = {
|
||||
username: cipDefine.selection.username,
|
||||
password: cipDefine.selection.password,
|
||||
fields: fieldIds
|
||||
|
|
@ -652,7 +653,8 @@ cipDefine.initDescription = function() {
|
|||
$description.append($btnAgain);
|
||||
$description.append($btnDismiss);
|
||||
|
||||
if (cip.settings['defined-credential-fields'] && cip.settings['defined-credential-fields'][document.location.href]) {
|
||||
const location = cip.getDocumentLocation();
|
||||
if (cip.settings['defined-credential-fields'] && cip.settings['defined-credential-fields'][location]) {
|
||||
const $p = jQuery('<p>').html('For this page credential fields are already selected and will be overwritten.<br />');
|
||||
const $btnDiscard = jQuery('<button>')
|
||||
.attr('id', 'btn-warning')
|
||||
|
|
@ -662,7 +664,7 @@ cipDefine.initDescription = function() {
|
|||
.addClass('btn-sm')
|
||||
.addClass('btn-danger')
|
||||
.click(function(e) {
|
||||
delete cip.settings['defined-credential-fields'][document.location.href];
|
||||
delete cip.settings['defined-credential-fields'][location];
|
||||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'save_settings',
|
||||
|
|
@ -907,7 +909,8 @@ cipFields.getCombination = function(givenType, fieldId) {
|
|||
}
|
||||
}
|
||||
// use defined credential fields (already loaded into combinations)
|
||||
if (cip.settings['defined-credential-fields'] && cip.settings['defined-credential-fields'][document.location.href]) {
|
||||
const location = cip.getDocumentLocation();
|
||||
if (cip.settings['defined-credential-fields'] && cip.settings['defined-credential-fields'][location]) {
|
||||
return cipFields.combinations[0];
|
||||
}
|
||||
|
||||
|
|
@ -1107,8 +1110,9 @@ cipFields.prepareCombinations = function(combinations) {
|
|||
};
|
||||
|
||||
cipFields.useDefinedCredentialFields = function() {
|
||||
if (cip.settings['defined-credential-fields'] && cip.settings['defined-credential-fields'][document.location.href]) {
|
||||
const creds = cip.settings['defined-credential-fields'][document.location.href];
|
||||
const location = cip.getDocumentLocation();
|
||||
if (cip.settings['defined-credential-fields'] && cip.settings['defined-credential-fields'][location]) {
|
||||
const creds = cip.settings['defined-credential-fields'][location];
|
||||
|
||||
let $found = _f(creds.username) || _f(creds.password);
|
||||
for (const i of creds.fields) {
|
||||
|
|
@ -1812,7 +1816,7 @@ cip.rememberCredentials = function(usernameValue, passwordValue) {
|
|||
|
||||
let url = jQuery(this)[0].action;
|
||||
if (!url) {
|
||||
url = cip.settings.saveDomainOnly ? document.location.origin : document.location.href;
|
||||
url = cip.getDocumentLocation();
|
||||
if (url.indexOf('?') > 0) {
|
||||
url = url.substring(0, url.indexOf('?'));
|
||||
if (url.length < document.location.origin.length) {
|
||||
|
|
@ -1853,6 +1857,10 @@ cip.ignoreSite = function(sites) {
|
|||
};
|
||||
|
||||
|
||||
cip.getDocumentLocation = function() {
|
||||
return cip.settings.saveDomainOnly ? document.location.origin : document.location.href;
|
||||
};
|
||||
|
||||
var cipEvents = {};
|
||||
|
||||
cipEvents.clearCredentials = function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue