Merge pull request #2387 from keepassxreboot/fix/adjust_segmented_totp

Adjust segmented TOTP detection
This commit is contained in:
Sami Vänttinen 2024-11-21 19:17:10 +02:00 committed by GitHub
commit 71cde7bc9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -96,7 +96,7 @@ kpxcFields.getSegmentedTOTPFields = function(inputs, combinations) {
let exceptionFound = false;
// Returns true if all 6 inputs are numeric, tel or text/number with maxLength of 1.
// Returns true if all 6 inputs are numeric, tel or text/number with maxLength of 1, or maxLength not defined.
// If ignoreFieldCount is true, number of TOTP fields are allowed to differ from the default (6),
// but 4 at minimum must exist.
const areFieldsSegmentedTotp = function(totpInputs, ignoreFieldCount = false) {
@ -106,7 +106,7 @@ kpxcFields.getSegmentedTOTPFields = function(inputs, combinations) {
totpInputs.every(
input =>
((input.inputMode === 'numeric' || input.inputMode === '') && input.pattern.includes('0-9')) ||
((input.type === 'text' || input.type === 'number') && input.maxLength === 1) ||
((input.type === 'text' || input.type === 'number') && (input.maxLength === 1 || input.maxLength === -1)) ||
input.type === 'tel'
)
);