From bb4281270cefb5011eaad130d254fb971de62fb5 Mon Sep 17 00:00:00 2001 From: Maveth Date: Tue, 23 Nov 2021 12:24:14 -0600 Subject: [PATCH] Fix error caused by negative or really big numbers --- capsulflask/payment.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/capsulflask/payment.py b/capsulflask/payment.py index a2e104e..8e10b61 100644 --- a/capsulflask/payment.py +++ b/capsulflask/payment.py @@ -36,10 +36,11 @@ def validate_dollars(): dollars = decimal.Decimal(request.form["dollars"]) except: errors.append("dollars must be a number") - - # TODO re enable this - # if dollars and dollars < decimal.Decimal(1): - # errors.append("dollars must be >= 1") + + if dollars and dollars < decimal.Decimal(1): + errors.append("dollars must be >= 1") + elif dollars and dollars >= decimal.Decimal(1000000): + errors.append("dollars must be < 1,000,000") return [errors, dollars]