For validation

This commit is contained in:
Arc
2020-01-29 12:34:42 +00:00
committed by GitHub
parent fc9b30bbee
commit 60739a7587

View File

@@ -229,6 +229,9 @@ def api_invoices():
return jsonify({"ERROR": "MUST BE JSON"}), 400 return jsonify({"ERROR": "MUST BE JSON"}), 400
postedjson = request.json postedjson = request.json
#Form validation
if int(postedjson["value"]) < 0 or not postedjson["memo"].replace(' ','').isalnum():
return jsonify({"ERROR": "FORM ERROR"}), 401
if "value" not in postedjson: if "value" not in postedjson:
return jsonify({"ERROR": "NO VALUE"}), 400 return jsonify({"ERROR": "NO VALUE"}), 400