diff --git a/app/assets/stylesheets/app.scss b/app/assets/stylesheets/app.scss index d2d7fb838..f1f9c8fc7 100644 --- a/app/assets/stylesheets/app.scss +++ b/app/assets/stylesheets/app.scss @@ -88,3 +88,23 @@ td { .heading-xlarge { margin-bottom: 20px; } + +#footer { + + .footer-categories { + + @extend %site-width-container; + + &-wrapper { + padding: 0 0 $gutter * 2; + margin: 0 0 $gutter; + border-bottom: 1px solid $border-colour; + } + + h2 { + margin: 0 0 $gutter-two-thirds; + } + + } + +} \ No newline at end of file diff --git a/app/main/views/api_keys.py b/app/main/views/api_keys.py index 8053e2cf9..0ee7b2220 100644 --- a/app/main/views/api_keys.py +++ b/app/main/views/api_keys.py @@ -6,10 +6,9 @@ from app import api_key_api_client from app.utils import user_has_permissions -@main.route("/services//documentation") -@login_required -def documentation(service_id): - return render_template('views/documentation.html', service_id=service_id) +@main.route("/documentation") +def documentation(): + return render_template('views/documentation.html') @main.route("/services//api-keys") diff --git a/app/main/views/code_not_received.py b/app/main/views/code_not_received.py index 36fcfc8dc..c7c94b457 100644 --- a/app/main/views/code_not_received.py +++ b/app/main/views/code_not_received.py @@ -41,4 +41,7 @@ def check_and_resend_verification_code(): # TODO there needs to be a way to generate a new session id user = user_api_client.get_user_by_email(session['user_details']['email']) user_api_client.send_verify_code(user.id, 'sms', user.mobile_number) - return redirect(url_for('main.two_factor')) + if user.state == 'pending': + return redirect(url_for('main.verify')) + else: + return redirect(url_for('main.two_factor')) diff --git a/app/main/views/two_factor.py b/app/main/views/two_factor.py index 063819b2d..31325a45a 100644 --- a/app/main/views/two_factor.py +++ b/app/main/views/two_factor.py @@ -16,6 +16,7 @@ from app.main.forms import TwoFactorForm @main.route('/two-factor', methods=['GET', 'POST']) def two_factor(): # TODO handle user_email not in session + try: user_id = session['user_details']['id'] except KeyError: diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index 8b773ce7c..7f2efc0b0 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -72,10 +72,31 @@ {% endblock %} +{% block footer_top %} + +{% endblock %} + {% block footer_support_links %} diff --git a/app/templates/main_nav.html b/app/templates/main_nav.html index 41065b7a1..5f670c24d 100644 --- a/app/templates/main_nav.html +++ b/app/templates/main_nav.html @@ -22,7 +22,6 @@ {% if current_user.has_permissions(['manage_api_keys', 'access_developer_docs']) %} {% endif %} diff --git a/app/templates/views/documentation.html b/app/templates/views/documentation.html index 073d94e33..13e6943a0 100644 --- a/app/templates/views/documentation.html +++ b/app/templates/views/documentation.html @@ -1,15 +1,15 @@ -{% extends "withnav_template.html" %} +{% extends "withoutnav_template.html" %} {% from "components/page-footer.html" import page_footer %} {% from "components/api-key.html" import api_key %} {% block page_title %} - Developer documentation – GOV.UK Notify + API documentation – GOV.UK Notify {% endblock %} {% block maincolumn_content %}

- Set up API integration + Developer documentation

@@ -81,7 +81,7 @@ {{ """ { - 'to': '+441234123123', + 'to': '+447700900404', 'template': 1 } """|syntax_highlight_json @@ -164,10 +164,6 @@ https://api.notify.works

-

- API keys for your service -

-
diff --git a/app/templates/views/verification-not-received.html b/app/templates/views/verification-not-received.html index 412f62625..da577cceb 100644 --- a/app/templates/views/verification-not-received.html +++ b/app/templates/views/verification-not-received.html @@ -16,7 +16,7 @@

- Resend verification code + Resend verification code

diff --git a/tests/app/main/views/test_code_not_received.py b/tests/app/main/views/test_code_not_received.py index 92be74682..87fbc9dce 100644 --- a/tests/app/main/views/test_code_not_received.py +++ b/tests/app/main/views/test_code_not_received.py @@ -97,10 +97,10 @@ def test_should_render_verification_code_not_received(app_, 'speak to your service manager to reset the number.' in response.get_data(as_text=True) -def test_check_and_redirect_to_two_factor(app_, - api_user_active, - mock_get_user_by_email, - mock_send_verify_code): +def test_check_and_redirect_to_two_factor_if_user_active(app_, + api_user_active, + mock_get_user_by_email, + mock_send_verify_code): with app_.test_request_context(): with app_.test_client() as client: with client.session_transaction() as session: @@ -112,6 +112,25 @@ def test_check_and_redirect_to_two_factor(app_, assert response.location == url_for('main.two_factor', _external=True) +def test_check_and_redirect_to_verify_if_user_pending(app_, + mocker, + api_user_pending, + mock_get_user_pending, + mock_send_verify_code): + + mocker.patch('app.user_api_client.get_user_by_email', return_value=api_user_pending) + + with app_.test_request_context(): + with app_.test_client() as client: + with client.session_transaction() as session: + session['user_details'] = { + 'id': api_user_pending.id, + 'email': api_user_pending.email_address} + response = client.get(url_for('main.check_and_resend_verification_code')) + assert response.status_code == 302 + assert response.location == url_for('main.verify', _external=True) + + def test_should_create_new_code_for_user(app_, api_user_active, mock_get_user_by_email, diff --git a/tests/app/main/views/test_dashboard.py b/tests/app/main/views/test_dashboard.py index ca8008ca5..50c4f63d3 100644 --- a/tests/app/main/views/test_dashboard.py +++ b/tests/app/main/views/test_dashboard.py @@ -86,7 +86,6 @@ def test_menu_manage_service(mocker, app_, api_user_active, service_one, mock_ge assert url_for('main.service_settings', service_id=service_one['id']) in page assert url_for('main.api_keys', service_id=service_one['id']) not in page - assert url_for('main.documentation', service_id=service_one['id']) not in page def test_menu_manage_api_keys(mocker, app_, api_user_active, service_one, mock_get_service_templates, mock_get_jobs): @@ -111,7 +110,6 @@ def test_menu_manage_api_keys(mocker, app_, api_user_active, service_one, mock_g assert url_for('main.service_settings', service_id=service_one['id']) not in page assert url_for('main.api_keys', service_id=service_one['id']) in page - assert url_for('main.documentation', service_id=service_one['id']) in page def test_menu_all_services_for_platform_admin_user(mocker, app_, platform_admin_user, service_one,