Merge pull request #1290 from keepassxreboot/fix/variable_check

Fix id and name check for form
This commit is contained in:
Sami Vänttinen 2021-04-03 11:42:10 +03:00 committed by GitHub
commit a0bf794a3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -407,8 +407,10 @@ kpxcFields.getSegmentedTOTPFields = function(inputs, combinations) {
};
const form = inputs.length > 0 ? inputs[0].form : undefined;
if (form && (acceptedOTPFields.some(f => form.className.includes(f) || form.id.includes(f) || form.name.includes(f))
|| form.length === 6)) {
if (form && (acceptedOTPFields.some(f => (form.className && form.className.includes(f))
|| (form.id && typeof(form.id) === 'string' && form.id.includes(f))
|| (form.name && typeof(form.name) === 'string' && form.name.includes(f))
|| form.length === 6))) {
// Use the form's elements
addTotpFieldsToCombination(form.elements);
} else if (inputs.length === 6 && inputs.every(i => i.inputMode === 'numeric' && i.pattern.includes('0-9'))) {