mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Merge pull request #1000 from keepassxreboot/fix/171_small_fixes
Various fixes for 1.7.1
This commit is contained in:
commit
c90cff8f65
7 changed files with 50 additions and 44 deletions
|
|
@ -190,7 +190,7 @@ kpxcAutocomplete.keyPress = function(e) {
|
||||||
if (kpxcAutocomplete.index >= 0 && items && items[kpxcAutocomplete.index] !== undefined) {
|
if (kpxcAutocomplete.index >= 0 && items && items[kpxcAutocomplete.index] !== undefined) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
kpxcAutocomplete.input.value = kpxcAutocomplete.elements[kpxcAutocomplete.index].value;
|
kpxcAutocomplete.input.value = kpxcAutocomplete.elements[kpxcAutocomplete.index].value;
|
||||||
kpxcAutocomplete.fillPassword(kpxcAutocomplete.input.value, kpxcAutocomplete.index);
|
kpxcAutocomplete.fillPassword(kpxcAutocomplete.input.value, kpxcAutocomplete.index, kpxcAutocomplete.elements[kpxcAutocomplete.index].uuid);
|
||||||
kpxcAutocomplete.closeList();
|
kpxcAutocomplete.closeList();
|
||||||
}
|
}
|
||||||
} else if (e.key === 'Tab') {
|
} else if (e.key === 'Tab') {
|
||||||
|
|
@ -201,7 +201,7 @@ kpxcAutocomplete.keyPress = function(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
kpxcAutocomplete.index = kpxcAutocomplete.elements.findIndex(c => c.value === kpxcAutocomplete.input.value);
|
kpxcAutocomplete.index = kpxcAutocomplete.elements.findIndex(c => c.value === kpxcAutocomplete.input.value);
|
||||||
kpxcAutocomplete.fillPassword(kpxcAutocomplete.input.value, kpxcAutocomplete.index);
|
kpxcAutocomplete.fillPassword(kpxcAutocomplete.input.value, kpxcAutocomplete.index, kpxcAutocomplete.elements[kpxcAutocomplete.index].uuid);
|
||||||
kpxcAutocomplete.closeList();
|
kpxcAutocomplete.closeList();
|
||||||
} else if (e.key === 'Escape') {
|
} else if (e.key === 'Escape') {
|
||||||
kpxcAutocomplete.closeList();
|
kpxcAutocomplete.closeList();
|
||||||
|
|
|
||||||
|
|
@ -144,11 +144,11 @@ kpxcBanner.saveNewCredentials = async function(credentials = {}) {
|
||||||
|
|
||||||
if (!result.defaultGroupAlwaysAsk) {
|
if (!result.defaultGroupAlwaysAsk) {
|
||||||
if (result.defaultGroup === '' || result.defaultGroup === DEFAULT_BROWSER_GROUP) {
|
if (result.defaultGroup === '' || result.defaultGroup === DEFAULT_BROWSER_GROUP) {
|
||||||
// Default group is used
|
// Default group is used
|
||||||
const args = [ credentials.username, credentials.password, credentials.url ];
|
const args = [ credentials.username, credentials.password, credentials.url ];
|
||||||
const res = await sendMessage('add_credentials', args);
|
const res = await sendMessage('add_credentials', args);
|
||||||
kpxcBanner.verifyResult(res);
|
kpxcBanner.verifyResult(res);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
// A specified group is used
|
// A specified group is used
|
||||||
let gname = '';
|
let gname = '';
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ kpxcDefine.diffX = 0;
|
||||||
kpxcDefine.diffY = 0;
|
kpxcDefine.diffY = 0;
|
||||||
kpxcDefine.eventFieldClick = null;
|
kpxcDefine.eventFieldClick = null;
|
||||||
kpxcDefine.inputQueryPattern = 'input[type=\'text\'], input[type=\'email\'], input[type=\'password\'], input[type=\'tel\'], input[type=\'number\'], input[type=\'username\'], input:not([type])';
|
kpxcDefine.inputQueryPattern = 'input[type=\'text\'], input[type=\'email\'], input[type=\'password\'], input[type=\'tel\'], input[type=\'number\'], input[type=\'username\'], input:not([type])';
|
||||||
kpxcDefine.markedFields= [];
|
kpxcDefine.markedFields = [];
|
||||||
kpxcDefine.keyDown = null;
|
kpxcDefine.keyDown = null;
|
||||||
kpxcDefine.startPosX = 0;
|
kpxcDefine.startPosX = 0;
|
||||||
kpxcDefine.startPosY = 0;
|
kpxcDefine.startPosY = 0;
|
||||||
|
|
|
||||||
|
|
@ -358,9 +358,9 @@ kpxcFields.getAllPageInputs = async function(previousInputs = []) {
|
||||||
if (!kpxc.singleInputEnabledForPage
|
if (!kpxc.singleInputEnabledForPage
|
||||||
&& ((fields.length === 1 && fields[0].getLowerCaseAttribute('type') !== 'password')
|
&& ((fields.length === 1 && fields[0].getLowerCaseAttribute('type') !== 'password')
|
||||||
|| (previousInputs.length === 1 && previousInputs[0].getLowerCaseAttribute('type') !== 'password'))) {
|
|| (previousInputs.length === 1 && previousInputs[0].getLowerCaseAttribute('type') !== 'password'))) {
|
||||||
sendMessage('username_field_detected', true );
|
sendMessage('username_field_detected', true);
|
||||||
} else {
|
} else {
|
||||||
sendMessage('username_field_detected', false );
|
sendMessage('username_field_detected', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
await kpxc.initCombinations(inputs);
|
await kpxc.initCombinations(inputs);
|
||||||
|
|
@ -390,11 +390,11 @@ kpxcFields.getCombination = async function(field, givenType) {
|
||||||
// Gets of generates an unique ID for the element
|
// Gets of generates an unique ID for the element
|
||||||
kpxcFields.getId = function(target) {
|
kpxcFields.getId = function(target) {
|
||||||
if (target.classList.length > 0) {
|
if (target.classList.length > 0) {
|
||||||
return `${target.nodeName} ${target.type} ${target.classList.value}`;
|
return `${target.nodeName} ${target.type} ${target.classList.value} ${target.name} ${target.placeholder}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.id && target.id !== '') {
|
if (target.id && target.id !== '') {
|
||||||
return `${target.nodeName} ${target.type} ${kpxcFields.prepareId(target.id)}`;
|
return `${target.nodeName} ${target.type} ${kpxcFields.prepareId(target.id)} ${target.name} ${target.placeholder}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `kpxc ${target.type} ${target.clientTop}${target.clientLeft}${target.clientWidth}${target.clientHeight}${target.offsetTop}${target.offsetLeft}`;
|
return `kpxc ${target.type} ${target.clientTop}${target.clientLeft}${target.clientWidth}${target.clientHeight}${target.offsetTop}${target.offsetLeft}`;
|
||||||
|
|
@ -530,7 +530,7 @@ kpxcFields.useCustomLoginFields = async function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
[ creds.username, creds.password, creds.totp ] = await Promise.all([
|
const [ username, password, totp ] = await Promise.all([
|
||||||
await findInputField(inputFields, creds.username),
|
await findInputField(inputFields, creds.username),
|
||||||
await findInputField(inputFields, creds.password),
|
await findInputField(inputFields, creds.password),
|
||||||
await findInputField(inputFields, creds.totp)
|
await findInputField(inputFields, creds.totp)
|
||||||
|
|
@ -546,17 +546,17 @@ kpxcFields.useCustomLoginFields = async function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle custom TOTP field
|
// Handle custom TOTP field
|
||||||
if (creds.totp) {
|
if (totp) {
|
||||||
creds.totp.setAttribute('kpxc-defined', 'totp');
|
totp.setAttribute('kpxc-defined', 'totp');
|
||||||
kpxcTOTPIcons.newIcon(creds.totp, kpxc.databaseState, true);
|
kpxcTOTPIcons.newIcon(totp, kpxc.databaseState, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
const combinations = [];
|
const combinations = [];
|
||||||
combinations.push({
|
combinations.push({
|
||||||
username: creds.username,
|
username: username,
|
||||||
password: creds.password,
|
password: password,
|
||||||
passwordInputs: [ creds.password ],
|
passwordInputs: [ password ],
|
||||||
totp: creds.totp,
|
totp: totp,
|
||||||
fields: stringFields
|
fields: stringFields
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -696,7 +696,7 @@ kpxc.fillInFromActiveElement = async function(passOnly = false) {
|
||||||
const el = document.activeElement;
|
const el = document.activeElement;
|
||||||
if (el.nodeName !== 'INPUT' || kpxc.credentials.length === 0) {
|
if (el.nodeName !== 'INPUT' || kpxc.credentials.length === 0) {
|
||||||
return;
|
return;
|
||||||
} else if (kpxc.credentials.length > 1 && kpxc.combinations.length > 0) {
|
} else if (kpxc.credentials.length > 1 && kpxc.combinations.length > 0 && kpxc.settings.autoCompleteUsernames) {
|
||||||
kpxcAutocomplete.showList(el);
|
kpxcAutocomplete.showList(el);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -723,15 +723,16 @@ kpxc.fillInFromActiveElement = async function(passOnly = false) {
|
||||||
|
|
||||||
// Fill requested by Auto-Fill
|
// Fill requested by Auto-Fill
|
||||||
kpxc.fillFromAutofill = async function() {
|
kpxc.fillFromAutofill = async function() {
|
||||||
if (kpxc.credentials.length !== 1 || kpxc.combinations.length !== 1) {
|
if (kpxc.credentials.length !== 1 || kpxc.combinations.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const index = kpxc.combinations.length - 1;
|
||||||
await sendMessage('page_set_login_id', 0);
|
await sendMessage('page_set_login_id', 0);
|
||||||
kpxc.fillInCredentials(kpxc.combinations[0], kpxc.credentials[0].login, kpxc.credentials[0].uuid);
|
kpxc.fillInCredentials(kpxc.combinations[index], kpxc.credentials[0].login, kpxc.credentials[0].uuid);
|
||||||
|
|
||||||
// Generate popup-list of usernames + descriptions
|
// Generate popup-list of usernames + descriptions
|
||||||
sendMessage('popup_login', [ `${kpxc.credentials[0].login} (${kpxc.credentials[0].name})` ]);
|
sendMessage('popup_login', [ { text: `${kpxc.credentials[0].login} (${kpxc.credentials[0].name})`, uuid: kpxc.credentials[0].uuid } ]);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Fill requested by selecting credentials from the popup
|
// Fill requested by selecting credentials from the popup
|
||||||
|
|
@ -783,7 +784,7 @@ kpxc.fillFromUsernameIcon = async function(combination) {
|
||||||
await kpxc.receiveCredentialsIfNecessary();
|
await kpxc.receiveCredentialsIfNecessary();
|
||||||
if (kpxc.credentials.length === 0) {
|
if (kpxc.credentials.length === 0) {
|
||||||
return;
|
return;
|
||||||
} else if (kpxc.credentials.length > 1) {
|
} else if (kpxc.credentials.length > 1 && kpxc.settings.autoCompleteUsernames) {
|
||||||
kpxcAutocomplete.showList(combination.username || combination.password);
|
kpxcAutocomplete.showList(combination.username || combination.password);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -854,7 +855,7 @@ kpxc.fillInCredentials = async function(combination, predefinedUsername, uuid, p
|
||||||
|
|
||||||
// Auto-submit
|
// Auto-submit
|
||||||
if (kpxc.settings.autoSubmit && !skipAutoSubmit) {
|
if (kpxc.settings.autoSubmit && !skipAutoSubmit) {
|
||||||
const submitButton = kpxc.getFormSubmitButton(combination.form);
|
const submitButton = kpxcForm.getFormSubmitButton(combination.form);
|
||||||
if (submitButton !== undefined) {
|
if (submitButton !== undefined) {
|
||||||
submitButton.click();
|
submitButton.click();
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1035,7 +1036,7 @@ kpxc.initCombinations = async function(inputs = []) {
|
||||||
|
|
||||||
// The main function for finding input fields
|
// The main function for finding input fields
|
||||||
kpxc.initCredentialFields = async function() {
|
kpxc.initCredentialFields = async function() {
|
||||||
await sendMessage('page_clear_logins', _called.clearLogins );
|
await sendMessage('page_clear_logins', _called.clearLogins);
|
||||||
_called.clearLogins = true;
|
_called.clearLogins = true;
|
||||||
|
|
||||||
// Identify all forms in the page
|
// Identify all forms in the page
|
||||||
|
|
@ -1060,7 +1061,7 @@ kpxc.initCredentialFields = async function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Combine inputs
|
// Combine inputs
|
||||||
kpxc.inputs = [...formInputs, ...pageInputs];
|
kpxc.inputs = [ ...formInputs, ...pageInputs ];
|
||||||
|
|
||||||
// Combinations are already saved when identifying fields
|
// Combinations are already saved when identifying fields
|
||||||
if (kpxc.combinations.length === 0) {
|
if (kpxc.combinations.length === 0) {
|
||||||
|
|
@ -1471,7 +1472,7 @@ kpxcObserverHelper.getInputs = function(target, ignoreVisibility = false) {
|
||||||
target.shadowSelectorAll('input').forEach(e => {
|
target.shadowSelectorAll('input').forEach(e => {
|
||||||
if (e.type !== 'hidden' && !e.disabled && !kpxcObserverHelper.alreadyIdentified(e)) {
|
if (e.type !== 'hidden' && !e.disabled && !kpxcObserverHelper.alreadyIdentified(e)) {
|
||||||
inputFields.push(e);
|
inputFields.push(e);
|
||||||
};
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1525,8 +1526,13 @@ kpxcObserverHelper.handleObserverAdd = async function(target) {
|
||||||
await kpxc.initCombinations(inputs);
|
await kpxc.initCombinations(inputs);
|
||||||
await kpxcIcons.initIcons(kpxc.combinations);
|
await kpxcIcons.initIcons(kpxc.combinations);
|
||||||
|
|
||||||
if (kpxc.databaseState === DatabaseState.UNLOCKED && _called.retrieveCredentials === false) {
|
if (kpxc.databaseState === DatabaseState.UNLOCKED) {
|
||||||
await kpxc.retrieveCredentials();
|
if (_called.retrieveCredentials === false) {
|
||||||
|
await kpxc.retrieveCredentials();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
kpxc.prepareCredentials();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1574,8 +1580,8 @@ kpxcObserverHelper.ignoredNode = function(target) {
|
||||||
|| kpxcObserverHelper.ignoredNodeNames.some(e => e === target.nodeName)
|
|| kpxcObserverHelper.ignoredNodeNames.some(e => e === target.nodeName)
|
||||||
|| target.nodeName.startsWith('YTMUSIC')
|
|| target.nodeName.startsWith('YTMUSIC')
|
||||||
|| target.nodeName.startsWith('YT-')) {
|
|| target.nodeName.startsWith('YT-')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
@ -1592,7 +1598,7 @@ kpxcObserverHelper.initObserver = async function() {
|
||||||
mutations = mutations.slice(0, _maximumMutations);
|
mutations = mutations.slice(0, _maximumMutations);
|
||||||
}
|
}
|
||||||
|
|
||||||
let styleMutations = [];
|
const styleMutations = [];
|
||||||
for (const mut of mutations) {
|
for (const mut of mutations) {
|
||||||
if (kpxcObserverHelper.ignoredNode(mut.target)) {
|
if (kpxcObserverHelper.ignoredNode(mut.target)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -1614,10 +1620,6 @@ kpxcObserverHelper.initObserver = async function() {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Listen for possible CSS animations
|
|
||||||
mut.target.removeEventListener('transitionend', kpxcObserverHelper.handleTransitionEnd);
|
|
||||||
mut.target.addEventListener('transitionend', kpxcObserverHelper.handleTransitionEnd);
|
|
||||||
|
|
||||||
// There's an issue here. We cannot know for sure if the class attribute if added or removed.
|
// There's an issue here. We cannot know for sure if the class attribute if added or removed.
|
||||||
kpxcObserverHelper.handleObserverAdd(mut.target);
|
kpxcObserverHelper.handleObserverAdd(mut.target);
|
||||||
}
|
}
|
||||||
|
|
@ -1658,7 +1660,7 @@ const initContentScript = async function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve submitted credentials if available.
|
// Retrieve submitted credentials if available.
|
||||||
const [creds, redirectCount] = await Promise.all([
|
const [ creds, redirectCount ] = await Promise.all([
|
||||||
await sendMessage('page_get_submitted'),
|
await sendMessage('page_get_submitted'),
|
||||||
await sendMessage('page_get_redirect_count')
|
await sendMessage('page_get_redirect_count')
|
||||||
]);
|
]);
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ kpxcPasswordDialog.showDialog = function(field, icon) {
|
||||||
// Save next password field if found
|
// Save next password field if found
|
||||||
if (kpxc.inputs.length > 0) {
|
if (kpxc.inputs.length > 0) {
|
||||||
const index = kpxc.inputs.indexOf(field);
|
const index = kpxc.inputs.indexOf(field);
|
||||||
const nextField = kpxc.inputs[index+1];
|
const nextField = kpxc.inputs[index + 1];
|
||||||
kpxcPasswordDialog.nextField = (nextField && nextField.getLowerCaseAttribute('type') === 'password') ? nextField : undefined;
|
kpxcPasswordDialog.nextField = (nextField && nextField.getLowerCaseAttribute('type') === 'password') ? nextField : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -278,7 +278,7 @@ kpxcPasswordDialog.fill = function(e) {
|
||||||
const message = tr('passwordGeneratorErrorTooLong') + '\r\n'
|
const message = tr('passwordGeneratorErrorTooLong') + '\r\n'
|
||||||
+ tr('passwordGeneratorErrorTooLongCut') + '\r\n' + tr('passwordGeneratorErrorTooLongRemember');
|
+ tr('passwordGeneratorErrorTooLongCut') + '\r\n' + tr('passwordGeneratorErrorTooLongRemember');
|
||||||
message.style.whiteSpace = 'pre';
|
message.style.whiteSpace = 'pre';
|
||||||
sendMessage('show_notification' [ message ]);
|
sendMessage('show_notification', [ message ]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,12 @@ kpxcTOTPIcons.isAcceptedTOTPField = function(field) {
|
||||||
const id = field.getLowerCaseAttribute('id');
|
const id = field.getLowerCaseAttribute('id');
|
||||||
const name = field.getLowerCaseAttribute('name');
|
const name = field.getLowerCaseAttribute('name');
|
||||||
const autocomplete = field.getLowerCaseAttribute('autocomplete');
|
const autocomplete = field.getLowerCaseAttribute('autocomplete');
|
||||||
|
const placeholder = field.getLowerCaseAttribute('placeholder');
|
||||||
|
|
||||||
if (autocomplete === 'one-time-code' || acceptedOTPFields.some(f => (id && id.includes(f)) || (name && name.includes(f)))) {
|
// Checks if the field id, name or placeholder includes some of the acceptedOTPFields but not any from ignoredTypes
|
||||||
|
if (autocomplete === 'one-time-code'
|
||||||
|
|| (acceptedOTPFields.some(f => (id && id.includes(f)) || (name && name.includes(f) || placeholder && placeholder.includes(f))))
|
||||||
|
&& !ignoredTypes.some(f => (id && id.includes(f)) || (name && name.includes(f) || placeholder && placeholder.includes(f)))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "KeePassXC-Browser",
|
"name": "KeePassXC-Browser",
|
||||||
"version": "1.7.0",
|
"version": "1.7.1",
|
||||||
"version_name": "1.7.0",
|
"version_name": "1.7.1",
|
||||||
"description": "__MSG_extensionDescription__",
|
"description": "__MSG_extensionDescription__",
|
||||||
"author": "KeePassXC Team",
|
"author": "KeePassXC Team",
|
||||||
"icons": {
|
"icons": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue