Invite users to choose how team members sign in

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.
This commit is contained in:
Chris Hill-Scott
2017-11-23 09:59:34 +00:00
parent e4b5dd9799
commit ba1c98ed49
4 changed files with 87 additions and 6 deletions

View File

@@ -536,6 +536,15 @@ def service_set_letters(service_id):
) )
@main.route("/services/<service_id>/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_id>/service-settings/letter-contacts", methods=['GET']) @main.route("/services/<service_id>/service-settings/letter-contacts", methods=['GET'])
@login_required @login_required
@user_has_permissions('manage_settings', admin_override=True) @user_has_permissions('manage_settings', admin_override=True)

View File

@@ -26,6 +26,16 @@
{{ edit_field('Change', url_for('.service_name_change', service_id=current_service.id)) }} {{ edit_field('Change', url_for('.service_name_change', service_id=current_service.id)) }}
{% endcall %} {% 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 %} {% endcall %}
{% call mapping_table( {% call mapping_table(

View File

@@ -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 %}
<div class="grid-row">
<div class="column-five-sixths">
<h1 class="heading-large">Sign-in method</h1>
{% if 'email_auth' in current_service.permissions %}
<p class="heading-small bottom-gutter-2-3">
Email link or text message code
</p>
<p>
Your team members can sign in with either a text message code
or an email link.
</p>
<p>
You can <a href="{{ url_for('.manage_users', service_id=current_service.id) }}">set the sign-in method for individual team members</a>.
</p>
{% else %}
<p class="heading-small bottom-gutter-2-3">
Text message code
</p>
<p>
Your team members sign in with a text message code.
</p>
<p>
If signing in with a text message is a problem for your team,
please <a href="{{ url_for('.support') }}">contact us</a>.
</p>
{% endif %}
{{ page_footer(
back_link=url_for('.service_settings', service_id=current_service.id),
back_link_text='Back to settings'
) }}
</div>
</div>
{% endblock %}

View File

@@ -46,6 +46,7 @@ def mock_get_service_settings_page_common(
'Label Value Action', 'Label Value Action',
'Service name service one Change', 'Service name service one Change',
'Sign-in method Text message code Change',
'Label Value Action', 'Label Value Action',
'Send emails On Change', 'Send emails On Change',
@@ -66,6 +67,7 @@ def mock_get_service_settings_page_common(
'Label Value Action', 'Label Value Action',
'Service name service one Change', 'Service name service one Change',
'Sign-in method Text message code Change',
'Label Value Action', 'Label Value Action',
'Send emails On Change', 'Send emails On Change',
@@ -122,6 +124,7 @@ def test_should_show_overview(
(['email', 'sms', 'inbound_sms', 'international_sms'], [ (['email', 'sms', 'inbound_sms', 'international_sms'], [
'Service name service one Change', 'Service name service one Change',
'Sign-in method Text message code Change',
'Label Value Action', 'Label Value Action',
'Send emails On Change', 'Send emails On Change',
@@ -139,9 +142,10 @@ def test_should_show_overview(
'Send letters Off Change', 'Send letters Off Change',
]), ]),
(['email', 'sms'], [ (['email', 'sms', 'email_auth'], [
'Service name service one Change', 'Service name service one Change',
'Sign-in method Email link or text message code Change',
'Label Value Action', 'Label Value Action',
'Send emails On Change', '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') 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 div.text.strip() == 'Not set'
assert 'default' in div.attrs['class'][0] 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') 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<br/>bar' in div assert 'foo<br/>bar' in div
assert '<script>' not in div assert '<script>' not in div
@@ -713,9 +717,9 @@ def test_and_more_hint_appears_on_settings_with_more_than_just_a_single_sender(
page.select('tbody tr')[index].text page.select('tbody tr')[index].text
) )
assert get_row(page, 2) == "Email reply to addresses test@example.com …and 2 more Manage" assert get_row(page, 3) == "Email reply to addresses test@example.com …and 2 more Manage"
assert get_row(page, 4) == "Text message sender Example …and 2 more Manage" assert get_row(page, 5) == "Text message sender Example …and 2 more Manage"
assert get_row(page, 9) == "Sender addresses 1 Example Street …and 2 more Manage" assert get_row(page, 10) == "Sender addresses 1 Example Street …and 2 more Manage"
@pytest.mark.parametrize('sender_list_page, expected_output', [ @pytest.mark.parametrize('sender_list_page, expected_output', [
@@ -2003,6 +2007,20 @@ def test_cant_resume_active_service(
'Your service can receive text messages sent to 0781239871.' 'Your service can receive text messages sent to 0781239871.'
) )
), ),
(
'main.service_set_auth_type',
[],
(
'Text message code'
)
),
(
'main.service_set_auth_type',
['email_auth'],
(
'Email link or text message code'
)
),
]) ])
def test_invitation_pages( def test_invitation_pages(
logged_in_client, logged_in_client,