Default service name if service name is not set on the session.

Pop service name off the session on sign out.
This commit is contained in:
Rebecca Law
2016-01-29 10:40:55 +00:00
parent 0dd20abbb3
commit 867ef7ad99
2 changed files with 5 additions and 3 deletions

View File

@@ -8,5 +8,7 @@ from app.main import main
@main.route('/sign-out', methods=(['GET']))
@login_required
def sign_out():
if session.get('service_name', None):
session.pop('service_name')
logout_user()
return redirect(url_for('main.index'))

View File

@@ -48,17 +48,17 @@
{% block content %}
{% if current_user.is_authenticated() %}
{% if current_user.is_authenticated() and session['service_name'] != None %}
<nav class="management-navigation">
<div class="grid-row">
<div class="column-half">
<details class="dropdown">
<summary class="dropdown-toggle">
{{ session['service_name'] }}
{{ session.get('service_name', 'Choose service') }}
</summary>
<div>
<a href="{{ url_for('main.choose_service') }}">Switch service</a>
<a href="{{ url_for('.add_service') }}">Add a new service to GOV.UK Notify</a>
<a href="{{ url_for('main.add_service') }}">Add a new service to GOV.UK Notify</a>
</div>
</details>
</div>