Bug in z3c.schema.payments

Mathias Gibbens <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
Hi List,

   There is a bug in z3c.schema.payments' validating of credit card 
numbers. The first check to make sure the leading digit is valid is 
actually checking the second digit. I noticed this because it wouldn't 
validate my own card number. I've attached a diff from the current SVN 
trunk which corrects this issue.

Mathias

_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
z3c.schema.diff (text/plain, 476 B)
Index: src/z3c/schema/payments/field.py
===================================================================
--- src/z3c/schema/payments/field.py	(revision 122267)
+++ src/z3c/schema/payments/field.py	(working copy)
@@ -27,7 +27,7 @@
        is low and pre-validating is fast"""
     
     financialIndustries = ['3','4','5','6']
-    if cardNum[1] not in financialIndustries:
+    if cardNum[0] not in financialIndustries:
         return False
         
     total = pos = 0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.