From ba1c98ed491a7ade2bf728fdb52b053b0eeb0ada Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 23 Nov 2017 09:59:34 +0000 Subject: [PATCH] Invite users to choose how team members sign in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Email auth is a new feature that currently we’ve only given to teams who have contact us with a problem. At the moment, we’re aware of all the teams that are sharing phone numbers when they sign in. We think that in the future there will be other teams who encounter this problem. So we should let them know that they should contact us if they are having the problem. At the moment we want to talk to teams before giving them access to the feature, so that we’re confident it’s only going to teams from whom it’s more secure than using a text message code. --- app/main/views/service_settings.py | 9 ++++ app/templates/views/service-settings.html | 10 +++++ .../views/service-settings/set-auth-type.html | 44 +++++++++++++++++++ tests/app/main/views/test_service_settings.py | 30 ++++++++++--- 4 files changed, 87 insertions(+), 6 deletions(-) create mode 100644 app/templates/views/service-settings/set-auth-type.html diff --git a/app/main/views/service_settings.py b/app/main/views/service_settings.py index effcea000..1210e0000 100644 --- a/app/main/views/service_settings.py +++ b/app/main/views/service_settings.py @@ -536,6 +536,15 @@ def service_set_letters(service_id): ) +@main.route("/services//service-settings/set-auth-type", methods=['GET']) +@login_required +@user_has_permissions('manage_settings', admin_override=True) +def service_set_auth_type(service_id): + return render_template( + 'views/service-settings/set-auth-type.html', + ) + + @main.route("/services//service-settings/letter-contacts", methods=['GET']) @login_required @user_has_permissions('manage_settings', admin_override=True) diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html index 07439ba83..02711a021 100644 --- a/app/templates/views/service-settings.html +++ b/app/templates/views/service-settings.html @@ -26,6 +26,16 @@ {{ edit_field('Change', url_for('.service_name_change', service_id=current_service.id)) }} {% endcall %} + {% call row() %} + {{ text_field('Sign-in method') }} + {{ text_field( + 'Email link or text message code' + if 'email_auth' in current_service.permissions + else 'Text message code' + ) }} + {{ edit_field('Change', url_for('.service_set_auth_type', service_id=current_service.id)) }} + {% endcall %} + {% endcall %} {% call mapping_table( diff --git a/app/templates/views/service-settings/set-auth-type.html b/app/templates/views/service-settings/set-auth-type.html new file mode 100644 index 000000000..338c027e2 --- /dev/null +++ b/app/templates/views/service-settings/set-auth-type.html @@ -0,0 +1,44 @@ +{% extends "withnav_template.html" %} +{% from "components/textbox.html" import textbox %} +{% from "components/page-footer.html" import page_footer %} + +{% block service_page_title %} + Text message sender +{% endblock %} + +{% block maincolumn_content %} + +
+
+

Sign-in method

+ {% if 'email_auth' in current_service.permissions %} +

+ Email link or text message code +

+

+ Your team members can sign in with either a text message code + or an email link. +

+

+ You can set the sign-in method for individual team members. +

+ {% else %} +

+ Text message code +

+

+ Your team members sign in with a text message code. +

+

+ If signing in with a text message is a problem for your team, + please contact us. +

+ {% endif %} + {{ page_footer( + back_link=url_for('.service_settings', service_id=current_service.id), + back_link_text='Back to settings' + ) }} +
+
+ +{% endblock %} diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index d2a9d45c8..b21f766aa 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -46,6 +46,7 @@ def mock_get_service_settings_page_common( 'Label Value Action', 'Service name service one Change', + 'Sign-in method Text message code Change', 'Label Value Action', 'Send emails On Change', @@ -66,6 +67,7 @@ def mock_get_service_settings_page_common( 'Label Value Action', 'Service name service one Change', + 'Sign-in method Text message code Change', 'Label Value Action', 'Send emails On Change', @@ -122,6 +124,7 @@ def test_should_show_overview( (['email', 'sms', 'inbound_sms', 'international_sms'], [ 'Service name service one Change', + 'Sign-in method Text message code Change', 'Label Value Action', 'Send emails On Change', @@ -139,9 +142,10 @@ def test_should_show_overview( 'Send letters Off Change', ]), - (['email', 'sms'], [ + (['email', 'sms', 'email_auth'], [ 'Service name service one Change', + 'Sign-in method Email link or text message code Change', 'Label Value Action', 'Send emails On Change', @@ -249,7 +253,7 @@ def test_letter_contact_block_shows_none_if_not_set( )) page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - div = page.find_all('tr')[8].find_all('td')[1].div + div = page.find_all('tr')[9].find_all('td')[1].div assert div.text.strip() == 'Not set' assert 'default' in div.attrs['class'][0] @@ -269,7 +273,7 @@ def test_escapes_letter_contact_block( )) page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') - div = str(page.find_all('tr')[8].find_all('td')[1].div) + div = str(page.find_all('tr')[9].find_all('td')[1].div) assert 'foo
bar' in div assert '