From 9c658bf0203a1d25fc62a597cb9aeffdf6359dc9 Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Wed, 6 Dec 2023 12:26:33 -0700 Subject: [PATCH 01/15] Fix verbage on front end to better reflect functionality --- app/main/forms.py | 2 +- app/templates/views/service-settings.html | 10 +++++----- .../views/service-settings/set-message-limit.html | 4 ++-- .../views/service_settings/test_service_settings.py | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/main/forms.py b/app/main/forms.py index fb9b7eeac..5e926dce4 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -1196,7 +1196,7 @@ class AdminServiceSMSAllowanceForm(StripWhitespaceForm): class AdminServiceMessageLimitForm(StripWhitespaceForm): message_limit = GovukIntegerField( - "Number of messages the service is allowed to send each day", + "Max number of messages the service has per send", validators=[DataRequired(message="Cannot be empty")], ) diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html index 9364880fc..c3e0803ab 100644 --- a/app/templates/views/service-settings.html +++ b/app/templates/views/service-settings.html @@ -93,7 +93,7 @@ ) }} {% endcall %} - + {% if current_user.platform_admin %} {% call settings_row(if_has_permission='sms') %} {{ text_field('Send international text messages') }} @@ -107,7 +107,7 @@ }} {% endcall %} {% endif %} - + + + {% if not notification %} + {% call field(align='right') %}{% endcall %} + {% else %} + + {% call field( + align='right' + ) %} +

+ {{ notification.carrier}} +

+ {% if displayed_on_single_line %}{% endif %} + {% endcall %} + {% endif %} +{% endmacro %} + +{% macro notification_carrier_message_field(notification) %} + + {% if not notification %} + {% call field(align='right') %}{% endcall %} + {% else %} + + {% call field( + status=status, + align='right' + ) %} +

+ {{notification.provider_response}} +

+ {% if displayed_on_single_line %}{% endif %} + {% endcall %} + {% endif %} +{% endmacro %} {% macro spark_bar_field( count, @@ -189,7 +225,7 @@ {% call field(align='right') %} - {{ '{:,.0f}'.format(count) }} + {{ '{:,.0f}'.format(count) }} -{% endblock %} \ No newline at end of file +{% endblock %} From 13d3ffd9143df7e1f1bb3cb12e88f00df143e863 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 12 Dec 2023 10:04:38 -0800 Subject: [PATCH 10/15] fixed typo --- app/templates/views/signedout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/views/signedout.html b/app/templates/views/signedout.html index 5014623d6..f672bf626 100644 --- a/app/templates/views/signedout.html +++ b/app/templates/views/signedout.html @@ -17,7 +17,7 @@ Notify.gov

Reach people where they are with government-powered text messages

-

Notify.gov is a text message service that helps federal, state, local, tribal and territorial goverments more effectively communicate with the people who use their services.

+

Notify.gov is a text message service that helps federal, state, local, tribal and territorial governments more effectively communicate with the people who use their services.

Sign in if you are an existing pilot partner From 218359411d2be5f6aa1bd06b5512f5f6469777cc Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 12 Dec 2023 10:16:06 -0800 Subject: [PATCH 11/15] updated test --- tests/app/main/views/test_index.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app/main/views/test_index.py b/tests/app/main/views/test_index.py index e9ea4dcf0..0b584962a 100644 --- a/tests/app/main/views/test_index.py +++ b/tests/app/main/views/test_index.py @@ -15,7 +15,7 @@ def test_non_logged_in_user_can_see_homepage( client_request.logout() page = client_request.get("main.index", _test_page_title=False) - assert page.h1.text.strip() == ("Send text messages to your participants") + assert page.h1.text.strip() == ("Reach people where they are with government-powered text messages") assert page.select_one("a.usa-button.usa-button--big")["href"] == url_for( "main.sign_in", From fea6e0a0d07088a6452d72f0da6443c7b7beae3e Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 12 Dec 2023 11:34:20 -0800 Subject: [PATCH 12/15] update content text --- app/templates/views/signedout.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/views/signedout.html b/app/templates/views/signedout.html index f672bf626..8c703d847 100644 --- a/app/templates/views/signedout.html +++ b/app/templates/views/signedout.html @@ -17,7 +17,7 @@ Notify.gov

Reach people where they are with government-powered text messages

-

Notify.gov is a text message service that helps federal, state, local, tribal and territorial governments more effectively communicate with the people who use their services.

+

Notify.gov is a text message service that helps federal, state, local, tribal and territorial governments more effectively communicate with the people they serve.

Sign in if you are an existing pilot partner From d35b490ee7e9fe448511890555c9174a69cb28d9 Mon Sep 17 00:00:00 2001 From: Jonathan Bobel Date: Tue, 12 Dec 2023 15:39:16 -0500 Subject: [PATCH 13/15] Moved the button to a more obvious place on the page --- app/templates/views/manage-users.html | 27 +++++++++++------------ tests/app/main/views/test_manage_users.py | 12 ++++------ 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/app/templates/views/manage-users.html b/app/templates/views/manage-users.html index bd91a2f04..f8585870e 100644 --- a/app/templates/views/manage-users.html +++ b/app/templates/views/manage-users.html @@ -9,9 +9,19 @@ {% block maincolumn_content %} -

- Team members -

+
+

+ Team members +

+ {% if current_user.has_permissions('manage_service') %} + {{ usaButton({ + "element": "a", + "text": "Invite a team member", + "href": url_for('.invite_user', service_id=current_service.id), + "classes": "usa-button--outline" + }) }} + {% endif %} +
{% if show_search_box %}
@@ -84,15 +94,4 @@ {% endfor %}
- {% if current_user.has_permissions('manage_service') %} -
- {{ usaButton({ - "element": "a", - "text": "Invite a team member", - "href": url_for('.invite_user', service_id=current_service.id), - "classes": "usa-button" - }) }} -
- {% endif %} - {% endblock %} diff --git a/tests/app/main/views/test_manage_users.py b/tests/app/main/views/test_manage_users.py index abc23b563..c5d97bd03 100644 --- a/tests/app/main/views/test_manage_users.py +++ b/tests/app/main/views/test_manage_users.py @@ -775,15 +775,11 @@ def test_should_show_page_for_inviting_user( def test_should_not_show_page_for_inviting_user_without_permissions( - client_request, - mock_get_template_folders, - active_user_empty_permissions + client_request, mock_get_template_folders, active_user_empty_permissions ): client_request.login(active_user_empty_permissions) page = client_request.get( - "main.invite_user", - service_id=SERVICE_ONE_ID, - _expected_status=403 + "main.invite_user", service_id=SERVICE_ONE_ID, _expected_status=403 ) assert "not allowed to see this page" in page.h1.string.strip() @@ -815,7 +811,7 @@ def test_should_show_page_for_inviting_user_with_email_prefilled( user_id=fake_uuid, # We have the user’s name in the H1 but don’t want it duplicated # in the page title - _test_page_title=False + _test_page_title=False, ) assert normalize_spaces(page.select_one("title").text).startswith( "Invite a team member" @@ -830,7 +826,7 @@ def test_should_show_page_if_prefilled_user_is_already_a_team_member( mock_get_template_folders, fake_uuid, active_user_with_permissions, - active_caseworking_user + active_caseworking_user, ): client_request.login(active_user_with_permissions) mocker.patch( From 13ed67b18b8cfeb1225ee72f5a9801d2823434fb Mon Sep 17 00:00:00 2001 From: Jonathan Bobel Date: Tue, 12 Dec 2023 16:45:21 -0500 Subject: [PATCH 14/15] 966 - Added 2 urls to the CSP configuration + adjusted the test --- app/__init__.py | 2 ++ tests/app/main/views/test_headers.py | 4 +++- tests/app/main/views/test_manage_users.py | 12 ++++-------- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 4346301da..0923b8a50 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -150,6 +150,8 @@ def _csp(config): "https://js-agent.newrelic.com", "https://gov-bam.nr-data.net", "https://www.googletagmanager.com", + "https://www.google-analytics.com", + "https://dap.digitalgov.gov", ], "connect-src": ["'self'", "https://gov-bam.nr-data.net"], "style-src": ["'self'", asset_domain], diff --git a/tests/app/main/views/test_headers.py b/tests/app/main/views/test_headers.py index de0cef7d2..fa6901617 100644 --- a/tests/app/main/views/test_headers.py +++ b/tests/app/main/views/test_headers.py @@ -18,7 +18,9 @@ def test_owasp_useful_headers_set( assert search( r"script-src 'self' static\.example\.com 'unsafe-eval' https:\/\/js-agent\.new" r"relic\.com https:\/\/gov-bam\.nr-data\.net https:\/\/www\.googletagmanager\." - r"com 'nonce-.*';", + r"com https:\/\/www\.google-analytics\." + r"com https:\/\/dap\.digitalgov\." + r"gov 'nonce-.*';", csp, ) assert search(r"connect-src 'self' https:\/\/gov-bam.nr-data\.net;", csp) diff --git a/tests/app/main/views/test_manage_users.py b/tests/app/main/views/test_manage_users.py index abc23b563..c5d97bd03 100644 --- a/tests/app/main/views/test_manage_users.py +++ b/tests/app/main/views/test_manage_users.py @@ -775,15 +775,11 @@ def test_should_show_page_for_inviting_user( def test_should_not_show_page_for_inviting_user_without_permissions( - client_request, - mock_get_template_folders, - active_user_empty_permissions + client_request, mock_get_template_folders, active_user_empty_permissions ): client_request.login(active_user_empty_permissions) page = client_request.get( - "main.invite_user", - service_id=SERVICE_ONE_ID, - _expected_status=403 + "main.invite_user", service_id=SERVICE_ONE_ID, _expected_status=403 ) assert "not allowed to see this page" in page.h1.string.strip() @@ -815,7 +811,7 @@ def test_should_show_page_for_inviting_user_with_email_prefilled( user_id=fake_uuid, # We have the user’s name in the H1 but don’t want it duplicated # in the page title - _test_page_title=False + _test_page_title=False, ) assert normalize_spaces(page.select_one("title").text).startswith( "Invite a team member" @@ -830,7 +826,7 @@ def test_should_show_page_if_prefilled_user_is_already_a_team_member( mock_get_template_folders, fake_uuid, active_user_with_permissions, - active_caseworking_user + active_caseworking_user, ): client_request.login(active_user_with_permissions) mocker.patch( From 6297091022213bbf15381aecee48e3f0734fc1f8 Mon Sep 17 00:00:00 2001 From: Jonathan Bobel Date: Wed, 13 Dec 2023 08:50:25 -0500 Subject: [PATCH 15/15] 1004 - Adding GA to connect-src --- app/__init__.py | 6 +++++- tests/app/main/views/test_headers.py | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/__init__.py b/app/__init__.py index 0923b8a50..c8224e21e 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -153,7 +153,11 @@ def _csp(config): "https://www.google-analytics.com", "https://dap.digitalgov.gov", ], - "connect-src": ["'self'", "https://gov-bam.nr-data.net"], + "connect-src": [ + "'self'", + "https://gov-bam.nr-data.net", + "https://www.google-analytics.com", + ], "style-src": ["'self'", asset_domain], "img-src": ["'self'", asset_domain, logo_domain], } diff --git a/tests/app/main/views/test_headers.py b/tests/app/main/views/test_headers.py index fa6901617..211601d16 100644 --- a/tests/app/main/views/test_headers.py +++ b/tests/app/main/views/test_headers.py @@ -23,6 +23,10 @@ def test_owasp_useful_headers_set( r"gov 'nonce-.*';", csp, ) - assert search(r"connect-src 'self' https:\/\/gov-bam.nr-data\.net;", csp) + assert search( + r"connect-src 'self' https:\/\/gov-bam.nr-data\.net https:\/\/www\.google-analytics\." + r"com;", + csp, + ) assert search(r"style-src 'self' static\.example\.com 'nonce-.*';", csp) assert search(r"img-src 'self' static\.example\.com static-logos\.test\.com", csp)