Skip to content

Commit

Permalink
Added validation for form name when submitting custom request forms
Browse files Browse the repository at this point in the history
  • Loading branch information
johnyu95 committed Aug 14, 2023
1 parent 4987fd0 commit faf17ff
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/request/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ def new():
custom_metadata = json.loads(
flask_request.form.get("custom-request-forms-data", {})
)
# validate that form_name exists in custom_metadata JSON
for key,value in custom_metadata.items():
form_name = value.get('form_name', None)
if not form_name:
flash('An unexpected error occurred. Please try submitting your request again.', category='danger')
return redirect(url_for("request.new"))
tz_name = (
escape(flask_request.form["tz-name"])
if flask_request.form["tz-name"]
Expand Down

0 comments on commit faf17ff

Please sign in to comment.