mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Add autocomplete to email address on register form
GOV.UK Design System recommends: > You should also set the autocomplete attribute to email. This lets > browsers autofill the email address on a user’s behalf if they’ve > entered it previously. Only doing this on the register and sign in forms because it’s unlikely to be helpful where a user is trying to enter someone else’s email address.
This commit is contained in:
@@ -14,7 +14,7 @@ Create an account
|
||||
<h1 class="heading-large">Create an account</h1>
|
||||
{% 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) }}
|
||||
{{ textbox(form.email_address, hint="Must be from a government organisation", width='3-4', safe_error_message=True, autocomplete='email') }}
|
||||
<div class="extra-tracking">
|
||||
{{ textbox(form.mobile_number, width='3-4', hint='We’ll send you a security code by text message') }}
|
||||
</div>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% call form_wrapper(autocomplete=True) %}
|
||||
{{ textbox(form.email_address) }}
|
||||
{{ textbox(form.email_address, autocomplete='email') }}
|
||||
{{ textbox(form.password) }}
|
||||
{{ page_footer("Continue", secondary_link=url_for('.forgot_password'), secondary_link_text="Forgot your password?") }}
|
||||
{% endcall %}
|
||||
|
||||
@@ -387,6 +387,16 @@ def test_invite_user_allows_to_choose_auth(
|
||||
assert sms_auth_radio_button.has_attr("disabled") is False
|
||||
|
||||
|
||||
def test_invite_user_has_correct_email_field(
|
||||
client_request,
|
||||
mock_get_users_by_service,
|
||||
mock_get_template_folders,
|
||||
):
|
||||
email_field = client_request.get('main.invite_user', service_id=SERVICE_ONE_ID).select_one('#email_address')
|
||||
assert email_field['spellcheck'] == 'false'
|
||||
assert 'autocomplete' not in email_field
|
||||
|
||||
|
||||
def test_should_not_show_page_for_non_team_member(
|
||||
client_request,
|
||||
mock_get_users_by_service,
|
||||
|
||||
@@ -16,6 +16,7 @@ def test_render_register_returns_template_with_form(client):
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
assert page.find('input', attrs={'name': 'auth_type'}).attrs['value'] == 'sms_auth'
|
||||
assert page.select_one('#email_address')['spellcheck'] == 'false'
|
||||
assert page.select_one('#email_address')['autocomplete'] == 'email'
|
||||
assert 'Create an account' in response.get_data(as_text=True)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user