Make sure caseworking users clear their invite

There was a bug where caseworking users skipped the part of the invite
flow where their invite was cleared from the session. This caused
a 500 if they later tried to create another service.

This commit makes sure that both types of user have the invite cleared
from the session after accepting it.
This commit is contained in:
Chris Hill-Scott
2018-07-05 11:45:09 +01:00
parent 9da9e85293
commit b21c0da683
4 changed files with 98 additions and 9 deletions

View File

@@ -62,13 +62,13 @@ def old_service_dashboard(service_id):
@user_has_permissions('view_activity', 'send_messages')
def service_dashboard(service_id):
if not current_user.has_permissions('view_activity'):
return redirect(url_for('main.choose_template', service_id=service_id))
if session.get('invited_user'):
session.pop('invited_user', None)
session['service_id'] = service_id
if not current_user.has_permissions('view_activity'):
return redirect(url_for('main.choose_template', service_id=service_id))
return render_template(
'views/dashboard/dashboard.html',
updates_url=url_for(".service_dashboard_updates", service_id=service_id),