diff --git a/app/main/views/choose_service.py b/app/main/views/choose_service.py index 657e6ab22..8a96f3524 100644 --- a/app/main/views/choose_service.py +++ b/app/main/views/choose_service.py @@ -16,8 +16,11 @@ def choose_service(): @main.route("/services-or-dashboard") -@login_required def show_all_services_or_dashboard(): + + if not current_user.is_authenticated(): + return redirect(url_for('.index')) + services = service_api_client.get_services({'user_id': current_user.id})['data'] if 1 == len(services): diff --git a/tests/app/main/views/test_choose_services.py b/tests/app/main/views/test_choose_services.py index ba8714fec..e1ecc14f1 100644 --- a/tests/app/main/views/test_choose_services.py +++ b/tests/app/main/views/test_choose_services.py @@ -59,7 +59,7 @@ def test_should_redirect_if_not_logged_in(app_): with app_.test_client() as client: response = client.get(url_for('main.show_all_services_or_dashboard')) assert response.status_code == 302 - assert url_for('main.sign_in', _external=True) in response.location + assert url_for('main.index', _external=True) in response.location def test_should_show_all_services_for_platform_admin_user(app_,