Merge pull request #1022 from keepassxreboot/fix/increase_max_totp_length

Increase max TOTP field length
This commit is contained in:
Sami Vänttinen 2020-10-12 07:05:16 +03:00 committed by GitHub
commit 911d4d18bf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,8 @@
const ignoreRegex = /(zip|postal).*code/i;
const ignoredTypes = [ 'email', 'password', 'username' ];
const MIN_INPUT_LENGTH = 6;
const MAX_INPUT_LENGTH = 10;
const acceptedOTPFields = [
'2fa',
@ -55,10 +57,8 @@ kpxcTOTPIcons.isValid = function(field, forced) {
if (ignoredTypes.some(t => t === field.type)
|| field.offsetWidth < MINIMUM_INPUT_FIELD_WIDTH
|| field.size < 2
|| (field.maxLength > 0 && (field.maxLength < 6 || field.maxLength > 8))
|| (field.maxLength > 0 && (field.maxLength < MIN_INPUT_LENGTH || field.maxLength > MAX_INPUT_LENGTH))
|| ignoredTypes.some(t => t === field.autocomplete)
|| field.getAttribute('kpxc-totp-field') === 'true'
|| (field.hasAttribute('kpxc-defined') && field.getAttribute('kpxc-defined') !== 'totp')
|| field.id.match(ignoreRegex)
|| field.name.match(ignoreRegex)
|| field.readOnly) {