From 8d3e9a8f1683da801e621ba88c5267c7786f5fb0 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Sat, 26 Sep 2020 12:12:55 +0300 Subject: [PATCH] Increase max TOTP field length --- keepassxc-browser/content/totp-field.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/keepassxc-browser/content/totp-field.js b/keepassxc-browser/content/totp-field.js index 15ecd4e..5f04814 100644 --- a/keepassxc-browser/content/totp-field.js +++ b/keepassxc-browser/content/totp-field.js @@ -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) {