diff --git a/app/templates/views/register.html b/app/templates/views/register.html index bc7130c38..43d07bb14 100644 --- a/app/templates/views/register.html +++ b/app/templates/views/register.html @@ -19,6 +19,7 @@ Create an account {{ textbox(form.password, hint="At least 8 characters", width='3-4') }} + {{form.auth_type}} {{ page_footer("Continue") }} diff --git a/app/templates/views/user-profile.html b/app/templates/views/user-profile.html index 3ddd1ffc1..588d4d319 100644 --- a/app/templates/views/user-profile.html +++ b/app/templates/views/user-profile.html @@ -1,5 +1,6 @@ {% extends "withoutnav_template.html" %} {% from "components/table.html" import list_table, row, field %} +{% from "components/table.html" import mapping_table, row, text_field, optional_text_field, edit_field, field, boolean_field %} {% block per_page_title %} Your profile @@ -9,33 +10,40 @@

Your profile

- {% call(item, row_number) list_table( - [ - {'label': 'Name', 'value': current_user.name, 'url': url_for('.user_profile_name')}, - {'label': 'Email address', 'value': current_user.email_address, 'url': url_for('.user_profile_email')}, - {'label': 'Mobile number', 'value': current_user.mobile_number, 'url': url_for('.user_profile_mobile_number')}, - {'label': 'Password', 'value': 'Last changed ' + current_user.password_changed_at|format_delta, 'url': url_for('.user_profile_password')}, - ], - caption='Account settings', - field_headings=['Setting', 'Value', 'Link to change'], + {% call mapping_table( + caption='Your profile', + field_headings=['Label', 'Value', 'Action'], field_headings_visible=False, caption_visible=False ) %} - {% call field() %} - {{ item.label }} + {% call row() %} + {{ text_field('Name') }} + {{ text_field(current_user.name) }} + {{ edit_field('Change', url_for('.user_profile_name')) }} {% endcall %} - {% call field() %} - {{ item.value }} - {% endcall %} - {% call field(align='right') %} - {% if item.label == 'Email address' %} - {% if can_see_edit %} - Change - {% endif %} + + {% call row() %} + {{ text_field('Email address') }} + {{ text_field(current_user.email_address) }} + {% if can_see_edit %} + {{ edit_field('Change', url_for('.user_profile_email')) }} {% else %} - Change + {{ text_field('') }} {% endif %} {% endcall %} + + {% call row() %} + {{ text_field('Mobile number') }} + {{ optional_text_field(current_user.mobile_number) }} + {{ edit_field('Change', url_for('.user_profile_mobile_number')) }} + {% endcall %} + + {% call row() %} + {{ text_field('Password') }} + {{ text_field('Last changed ' + current_user.password_changed_at|format_delta) }} + {{ edit_field('Change', url_for('.user_profile_password')) }} + {% endcall %} + {% endcall %} {% endblock %} diff --git a/tests/app/main/views/test_register.py b/tests/app/main/views/test_register.py index ca83de216..ba5cc3b9e 100644 --- a/tests/app/main/views/test_register.py +++ b/tests/app/main/views/test_register.py @@ -16,6 +16,8 @@ def test_render_register_returns_template_with_form(client): response = client.get('/register') assert response.status_code == 200 + page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') + assert page.find('input', attrs={'name': 'auth_type'}).attrs['value'] == 'sms_auth' assert 'Create an account' in response.get_data(as_text=True)