Merge pull request #1368 from keepassxreboot/fix/check_for_form_opacity

Check for form opacity
This commit is contained in:
Sami Vänttinen 2021-07-18 14:09:01 +03:00 committed by GitHub
commit 178a5bedcf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View file

@ -631,7 +631,9 @@ kpxcFields.isVisible = function(elem) {
// Check CSS visibility
const elemStyle = getComputedStyle(elem);
const opacity = Number(elemStyle.opacity);
if (elemStyle.visibility && (elemStyle.visibility === 'hidden' || elemStyle.visibility === 'collapse')
|| (opacity < MIN_OPACITY || opacity > MAX_OPACITY)
|| parseInt(elemStyle.width, 10) <= MIN_INPUT_FIELD_WIDTH_PX
|| parseInt(elemStyle.height, 10) <= MIN_INPUT_FIELD_WIDTH_PX) {
return false;
@ -642,6 +644,11 @@ kpxcFields.isVisible = function(elem) {
return false;
}
// If the input field belongs to a form, check its visibility also
if (elem.nodeName === 'INPUT' && elem.form && !kpxcFields.isVisible(elem.form)) {
return false;
}
return true;
};

View file

@ -4,6 +4,8 @@ const MIN_TOTP_INPUT_LENGTH = 6;
const MAX_TOTP_INPUT_LENGTH = 10;
const MIN_INPUT_FIELD_WIDTH_PX = 8;
const MIN_INPUT_FIELD_OFFSET_WIDTH = 60;
const MIN_OPACITY = 0.7;
const MAX_OPACITY = 1;
const DatabaseState = {
DISCONNECTED: 0,