Fix error case where the tour start page is skipped

This was causing us to key error for 'placeholders' being missing in the
session dictionary. This fixes it and sends you back to the start
This commit is contained in:
David McDonald
2020-10-02 12:46:02 +01:00
parent 6f8a2721d9
commit 1f900e74a9
2 changed files with 58 additions and 0 deletions
+10
View File
@@ -49,6 +49,11 @@ def tour_step(service_id, template_id, step_index):
if db_template['template_type'] != 'sms':
abort(404)
if 'placeholders' not in session:
return redirect(url_for(
'.begin_tour', service_id=current_service.id, template_id=template_id
))
template = get_template(
db_template,
current_service,
@@ -119,6 +124,11 @@ def check_tour_notification(service_id, template_id):
show_recipient=True,
)
if 'placeholders' not in session:
return redirect(url_for(
'.begin_tour', service_id=current_service.id, template_id=template_id
))
placeholders = fields_to_fill_in(template, prefill_current_user=True)
if not all_placeholders_in_session(template.placeholders):