summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/autofill/core/browser/autofill_manager.cc11
1 files changed, 9 insertions, 2 deletions
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index 5f20b39..ab1f405 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -299,8 +299,15 @@ bool AutofillManager::ShouldShowScanCreditCard(const FormData& form,
return false;
AutofillField* autofill_field = GetAutofillField(form, field);
- return autofill_field &&
- autofill_field->Type().GetStorableType() == CREDIT_CARD_NUMBER;
+ if (!autofill_field ||
+ autofill_field->Type().GetStorableType() != CREDIT_CARD_NUMBER) {
+ return false;
+ }
+
+ static const int kShowScanCreditCardMaxValueLength = 6;
+ return field.value.size() <= kShowScanCreditCardMaxValueLength &&
+ base::ContainsOnlyChars(CreditCard::StripSeparators(field.value),
+ base::ASCIIToUTF16("0123456789"));
}
bool AutofillManager::OnFormSubmitted(const FormData& form,