Merge pull request #716 from keepassxreboot/fix/totp_field_min_size

Ignore TOTP icons if the field is too small
This commit is contained in:
Sami Vänttinen 2020-01-06 20:44:16 +02:00 committed by GitHub
commit f824aca2b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,7 @@
'use strict';
const MINIMUM_SIZE = 60;
var kpxcTOTPIcons = {};
kpxcTOTPIcons.icons = [];
@ -25,7 +27,11 @@ class TOTPFieldIcon extends Icon {
};
TOTPFieldIcon.prototype.initField = function(field) {
if (!field || field.getAttribute('kpxc-totp-field') === 'true') {
if (!field
|| field.getAttribute('kpxc-totp-field') === 'true'
|| field.offsetWidth < MINIMUM_SIZE
|| field.size < 2
|| (field.maxLength > 0 && field.maxLength < 4)) {
return;
}