biddyweb / substruct

Automatically exported from code.google.com/p/substruct
0 stars 0 forks source link

Quantity validation #151

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Change a product
2. Enters an invalid character like "abc"
3. There are not validation on the quantity 

What is the expected output? 
An error message. 

What do you see instead?
The application goes to the checkout with a free product ;)

What version of the product are you using?
v1.0.a6

On what operating system?
GNU/Linux - OpenSuse 11

Original issue reported on code.google.com by rod...@gmail.com on 29 Nov 2008 at 6:39

GoogleCodeExporter commented 9 years ago
I assume that's "change a product in the admin interface"?

Original comment by rogerpack2005 on 30 Nov 2008 at 6:36

GoogleCodeExporter commented 9 years ago
Hi rogerpack2005,

No, in the website front-end. All sites that Ive been tested have this problem.
Imagine that I bought product A and in the quantity has "a" character in "How 
many do
you want?" input text. When I will buy the product B I will pay only for the 
product B!
Substruct allow this and I go to checkout (e.g paypal) with two products but 
paying
for only product B! 

Original comment by rod...@gmail.com on 30 Nov 2008 at 11:33

GoogleCodeExporter commented 9 years ago
I think a simple check can be added to add_to_cart_ajax in store_controller 
that does
a strict check for the integer-ness of the quantity entered. I don't think an 
error
needs to be raised on invalid input, since it's harmless. See my patch for 
details.

Original comment by ceager on 8 Dec 2008 at 9:18

Attachments:

GoogleCodeExporter commented 9 years ago
Cool, good catch. I'll take a look @ the patch and roll in ASAP. Does the patch
account for -numbers as well?

Original comment by subim...@gmail.com on 8 Dec 2008 at 9:59

GoogleCodeExporter commented 9 years ago
Negative quantities are subtracted from the cart, but it's handled more cleanly 
in the patch for issue 154. (In the 
original patch, if there might be an item of quantity 0 in the cart). I've 
combined the two patches in one file, 
attached.

Original comment by ceager on 18 Dec 2008 at 10:48

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed r175

Thanks for the test code!

Original comment by subim...@gmail.com on 25 Jan 2009 at 8:47