diff --git a/fosspay/blueprints/html.py b/fosspay/blueprints/html.py
index c7e4fcc..ab42cb6 100644
--- a/fosspay/blueprints/html.py
+++ b/fosspay/blueprints/html.py
@@ -205,3 +205,15 @@ def panel():
return render_template("panel.html",
one_times=lambda u: [d for d in u.donations if d.type == DonationType.one_time],
recurring=lambda u: [d for d in u.donations if d.type == DonationType.monthly and d.active])
+
+@html.route("/cancel/")
+@loginrequired
+def cancel(id):
+ donation = Donation.query.filter(Donation.id == id).first()
+ if donation.user != current_user:
+ abort(401)
+ if donation.type != DonationType.monthly:
+ abort(400)
+ donation.active = False
+ db.commit()
+ return redirect("/panel")
diff --git a/scripts/index.js b/scripts/index.js
index 4bf2164..6f3d847 100644
--- a/scripts/index.js
+++ b/scripts/index.js
@@ -43,6 +43,9 @@
if (isNaN(value)) {
value = 1;
}
+ if (value <= 0) {
+ value = 1;
+ }
e.target.value = value;
donation.amount = value * 100;
});