| Index: components/autofill/core/browser/validation.cc
|
| diff --git a/components/autofill/core/browser/validation.cc b/components/autofill/core/browser/validation.cc
|
| index 9d561f5126919c75b1568e4abca56ba6fde1f84b..a8aef35f7caafa62f9c31b03c238725922745d03 100644
|
| --- a/components/autofill/core/browser/validation.cc
|
| +++ b/components/autofill/core/browser/validation.cc
|
| @@ -78,11 +78,18 @@ bool IsValidCreditCardNumber(const base::string16& text) {
|
| return false;
|
| if (type == kMasterCard && number.size() != 16)
|
| return false;
|
| + if (type == kUnionPay && (number.size() < 16 || number.size() > 19))
|
| + return false;
|
| if (type == kVisaCard && number.size() != 13 && number.size() != 16)
|
| return false;
|
| if (type == kGenericCard && (number.size() < 12 || number.size() > 19))
|
| return false;
|
|
|
| + // Unlike all the other supported types, UnionPay cards lack Luhn checksum
|
| + // validation.
|
| + if (type == kUnionPay)
|
| + return true;
|
| +
|
| // Use the Luhn formula [3] to validate the number.
|
| // [3] http://en.wikipedia.org/wiki/Luhn_algorithm
|
| int sum = 0;
|
|
|