mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Prevent scripts to use autocomplete
This commit is contained in:
parent
c3a36027b5
commit
570ca76cca
1 changed files with 26 additions and 3 deletions
|
|
@ -127,11 +127,17 @@ cipAutocomplete.init = function(field) {
|
|||
.focus(cipAutocomplete.onFocus);
|
||||
};
|
||||
|
||||
cipAutocomplete.onClick = function() {
|
||||
cipAutocomplete.onClick = function(e) {
|
||||
if (!cipAutocomplete.isTrusted(e)) {
|
||||
return;
|
||||
}
|
||||
jQuery(this).autocomplete('search', jQuery(this).val());
|
||||
};
|
||||
|
||||
cipAutocomplete.onOpen = function(event, ui) {
|
||||
cipAutocomplete.onOpen = function(e, ui) {
|
||||
if (!cipAutocomplete.isTrusted(e)) {
|
||||
return;
|
||||
}
|
||||
jQuery('ul.ui-autocomplete.ui-menu').css('z-index', 2147483636);
|
||||
};
|
||||
|
||||
|
|
@ -145,6 +151,9 @@ cipAutocomplete.onSource = function(request, callback) {
|
|||
};
|
||||
|
||||
cipAutocomplete.onSelect = function(e, ui) {
|
||||
if (!cipAutocomplete.isTrusted(e)) {
|
||||
return;
|
||||
}
|
||||
e.preventDefault();
|
||||
cip.setValueWithChange(jQuery(this), ui.item.value);
|
||||
const fieldId = cipFields.prepareId(jQuery(this).attr('data-cip-id'));
|
||||
|
|
@ -171,7 +180,10 @@ cipAutocomplete.onBlur = function() {
|
|||
}
|
||||
};
|
||||
|
||||
cipAutocomplete.onFocus = function() {
|
||||
cipAutocomplete.onFocus = function(e) {
|
||||
if (!cipAutocomplete.isTrusted(e)) {
|
||||
return;
|
||||
}
|
||||
cip.u = jQuery(this);
|
||||
|
||||
if (jQuery(this).val() === '') {
|
||||
|
|
@ -179,6 +191,17 @@ cipAutocomplete.onFocus = function() {
|
|||
}
|
||||
};
|
||||
|
||||
// Search for isTrusted from jQuery's originalEvent
|
||||
cipAutocomplete.isTrusted = function(e) {
|
||||
for (let f = e.originalEvent; f !== null; f = f.originalEvent) {
|
||||
if (f.isTrusted !== undefined) {
|
||||
return f.isTrusted;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
var cipPassword = {};
|
||||
cipPassword.observedIcons = [];
|
||||
cipPassword.observingLock = false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue