mirror of
https://github.com/jquery-validation/jquery-validation.git
synced 2025-12-20 09:11:40 +01:00
Restricting credit card validator to include length check. Closes gh-772
Without this, '41111' is considered a valid credit card number.
This commit is contained in:
committed by
Jörn Zaefferer
parent
4bf813b751
commit
f5f47c5c66
@@ -1057,6 +1057,12 @@ $.extend($.validator, {
|
||||
|
||||
value = value.replace(/\D/g, "");
|
||||
|
||||
// Basing min and max length on
|
||||
// http://developer.ean.com/general_info/Valid_Credit_Card_Types
|
||||
if ( value.length < 13 || value.length > 19 ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (var n = value.length - 1; n >= 0; n--) {
|
||||
var cDigit = value.charAt(n);
|
||||
nDigit = parseInt(cDigit, 10);
|
||||
|
||||
Reference in New Issue
Block a user