diff --git a/app/main/validators.py b/app/main/validators.py index 39bf2fb0b..f35d6208a 100644 --- a/app/main/validators.py +++ b/app/main/validators.py @@ -43,11 +43,10 @@ class ValidGovEmail: return from flask import url_for - message = ( - 'Enter a government email address.' - ' If you think you should have access' - ' contact us' - ).format(url_for('main.support')) + message = ''' + Enter a public sector email address or + find out who can use Notify + '''.format(url_for('main.who_its_for')) if not is_gov_user(field.data.lower()): raise ValidationError(message) diff --git a/app/main/views/index.py b/app/main/views/index.py index 86c244d6f..062230eb2 100644 --- a/app/main/views/index.py +++ b/app/main/views/index.py @@ -320,6 +320,14 @@ def get_started(): ) +@main.route('/using-notify/who-its-for') +def who_its_for(): + return render_template( + 'views/guidance/who-its-for.html', + navigation_links=using_notify_nav(), + ) + + @main.route('/trial-mode') @main.route('/features/trial-mode') def trial_mode(): diff --git a/app/main/views/sub_navigation_dictionaries.py b/app/main/views/sub_navigation_dictionaries.py index b3acbb468..3acd67136 100644 --- a/app/main/views/sub_navigation_dictionaries.py +++ b/app/main/views/sub_navigation_dictionaries.py @@ -52,6 +52,10 @@ def using_notify_nav(): "name": "Get started", "link": "main.get_started", }, + { + "name": "Who it’s for", + "link": "main.who_its_for", + }, { "name": "Trial mode", "link": "main.trial_mode_new", diff --git a/app/navigation.py b/app/navigation.py index 53f01483c..b4bbd4429 100644 --- a/app/navigation.py +++ b/app/navigation.py @@ -346,6 +346,7 @@ class HeaderNavigation(Navigation): 'no_cookie.view_template_version_preview', 'view_template_versions', 'whitelist', + 'who_its_for', } # header HTML now comes from GOVUK Frontend so requires a boolean, not an attribute @@ -659,6 +660,7 @@ class MainNavigation(Navigation): 'view_provider', 'view_providers', 'no_cookie.view_template_version_preview', + 'who_its_for', } @@ -963,6 +965,7 @@ class CaseworkNavigation(Navigation): 'no_cookie.view_template_version_preview', 'view_template_versions', 'whitelist', + 'who_its_for', } @@ -1268,4 +1271,5 @@ class OrgNavigation(Navigation): 'no_cookie.view_template_version_preview', 'view_template_versions', 'whitelist', + 'who_its_for', } diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index 96e3d0cf4..804f65809 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -217,6 +217,10 @@ "href": url_for("main.get_started"), "text": "Get started" }, + { + "href": url_for("main.who_its_for"), + "text": "Who it’s for", + }, { "href": url_for("main.trial_mode_new"), "text": "Trial mode" diff --git a/app/templates/views/get-started.html b/app/templates/views/get-started.html index 489791f17..bbbe0969e 100644 --- a/app/templates/views/get-started.html +++ b/app/templates/views/get-started.html @@ -15,21 +15,9 @@
  • Check if GOV.UK Notify is right for you

    Read about our features, pricing and roadmap.

    - {{ govukDetails({ - "summaryText": "Organisations that can use Notify", - "html": ''' -
    -

    Notify is available to:

    - -

    Notify is not currently available to charities.

    -
    ''' - }) }} +

    + Check whether your organisation can use Notify. +

  • diff --git a/app/templates/views/guidance/who-its-for.html b/app/templates/views/guidance/who-its-for.html new file mode 100644 index 000000000..5f5055637 --- /dev/null +++ b/app/templates/views/guidance/who-its-for.html @@ -0,0 +1,49 @@ +{% extends "content_template.html" %} +{% from "components/page-header.html" import page_header %} + +{% block per_page_title %} + Who it’s for +{% endblock %} + +{% block content_column_content %} + + {{ page_header( + 'Who it’s for' + ) }} + +

    + GOV.UK Notify is available to: +

    + +

    + Notify is not currently available to charities. +

    +

    + If you work for one of these organisations but get an error when you try to create an account, contact support. +

    + +

    Suppliers

    +

    + If you’re doing work for a public sector organisation you can use GOV.UK Notify. +

    +

    + Someone from the public sector organisation you’re working with needs to set up the account. Then they can invite you as a team member. +

    + +

    Members of the public

    +

    + The GOV.UK Notify service is only for people who work in the government + or other public sector organisations. +

    +

    + Find government services and information on GOV.UK. +

    + +{% endblock %} diff --git a/app/templates/views/register.html b/app/templates/views/register.html index 71611a4ae..dfcf141bf 100644 --- a/app/templates/views/register.html +++ b/app/templates/views/register.html @@ -14,7 +14,7 @@ Create an account

    Create an account

    {% call form_wrapper(autocomplete=True) %} {{ textbox(form.name, width='3-4') }} - {{ textbox(form.email_address, hint="Must be from a government organisation", width='3-4', safe_error_message=True, autocomplete='email') }} + {{ textbox(form.email_address, hint="Must be from a public sector organisation", width='3-4', safe_error_message=True, autocomplete='email') }}
    {{ textbox(form.mobile_number, width='3-4', hint='We’ll send you a security code by text message') }}
    diff --git a/tests/app/main/test_validators.py b/tests/app/main/test_validators.py index cb3a0b375..1aaeaa01d 100644 --- a/tests/app/main/test_validators.py +++ b/tests/app/main/test_validators.py @@ -36,7 +36,7 @@ def test_valid_email_not_in_valid_domains( ): form = RegisterUserForm(email_address="test@test.com", mobile_number='441231231231') assert not form.validate() - assert "Enter a government email address" in form.errors['email_address'][0] + assert "Enter a public sector email address" in form.errors['email_address'][0] def test_valid_email_in_valid_domains( diff --git a/tests/app/main/views/test_index.py b/tests/app/main/views/test_index.py index 246cdfdd3..5b708ab61 100644 --- a/tests/app/main/views/test_index.py +++ b/tests/app/main/views/test_index.py @@ -83,7 +83,7 @@ def test_robots(client): 'features_letters', 'how_to_pay', 'get_started', 'guidance_index', 'branding_and_customisation', 'create_and_send_messages', 'edit_and_format_messages', - 'send_files_by_email', 'upload_a_letter', + 'send_files_by_email', 'upload_a_letter', 'who_its_for', ]) def test_static_pages( client_request, diff --git a/tests/app/main/views/test_manage_users.py b/tests/app/main/views/test_manage_users.py index 9832d4c12..36095e59b 100644 --- a/tests/app/main/views/test_manage_users.py +++ b/tests/app/main/views/test_manage_users.py @@ -1192,7 +1192,7 @@ def test_edit_user_email_cannot_change_a_gov_email_address_to_a_non_gov_email_ad }, _expected_status=200, ) - assert 'Enter a government email address.' in page.find('span', class_='error-message').text + assert 'Enter a public sector email address' in page.select_one('.error-message').text with client_request.session_transaction() as session: assert 'team_member_email_change-'.format(active_user_with_permissions['id']) not in session diff --git a/tests/app/main/views/test_register.py b/tests/app/main/views/test_register.py index fdb4a4e6f..6cf7a8c16 100644 --- a/tests/app/main/views/test_register.py +++ b/tests/app/main/views/test_register.py @@ -7,6 +7,7 @@ from flask import session, url_for from flask_login import current_user from app.models.user import InvitedUser +from tests.conftest import normalize_spaces def test_render_register_returns_template_with_form(client): @@ -97,20 +98,27 @@ def test_process_register_returns_200_when_mobile_number_is_invalid( def test_should_return_200_when_email_is_not_gov_uk( - client, - mock_send_verify_code, - mock_get_user_by_email, + client_request, mock_get_organisations, - mock_login, ): - response = client.post(url_for('main.register'), - data={'name': 'Bad Mobile', - 'email_address': 'bad_mobile@example.not.right', - 'mobile_number': '+44123412345', - 'password': 'validPassword!'}) + client_request.logout() + page = client_request.post( + 'main.register', + _data={ + 'name': 'Firstname Lastname', + 'email_address': 'bad_mobile@example.not.right', + 'mobile_number': '07900900123', + 'password': 'validPassword!' + }, + _expected_status=200, + ) - assert response.status_code == 200 - assert 'Enter a government email address' in response.get_data(as_text=True) + assert normalize_spaces(page.select_one('.error-message').text) == ( + 'Enter a public sector email address or find out who can use Notify' + ) + assert page.select_one('.error-message a')['href'] == url_for( + 'main.who_its_for' + ) @pytest.mark.parametrize('email_address', (