mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-14 10:58:58 -04:00
Merge pull request #3990 from alphagov/fix-profile-links
Give user profile change links more context
This commit is contained in:
@@ -20,14 +20,24 @@
|
||||
{% call row() %}
|
||||
{{ text_field('Name') }}
|
||||
{{ text_field(current_user.name) }}
|
||||
{{ edit_field('Change', url_for('.user_profile_name')) }}
|
||||
{{ edit_field(
|
||||
'Change',
|
||||
url_for('.user_profile_name'),
|
||||
suffix='name'
|
||||
)
|
||||
}}
|
||||
{% endcall %}
|
||||
|
||||
{% call row() %}
|
||||
{{ text_field('Email address') }}
|
||||
{{ text_field(current_user.email_address) }}
|
||||
{% if can_see_edit %}
|
||||
{{ edit_field('Change', url_for('.user_profile_email')) }}
|
||||
{{ edit_field(
|
||||
'Change',
|
||||
url_for('.user_profile_email'),
|
||||
suffix='email address'
|
||||
)
|
||||
}}
|
||||
{% else %}
|
||||
{{ text_field('') }}
|
||||
{% endif %}
|
||||
@@ -36,13 +46,23 @@
|
||||
{% call row() %}
|
||||
{{ text_field('Mobile number') }}
|
||||
{{ optional_text_field(current_user.mobile_number) }}
|
||||
{{ edit_field('Change', url_for('.user_profile_mobile_number')) }}
|
||||
{{ edit_field(
|
||||
'Change',
|
||||
url_for('.user_profile_mobile_number'),
|
||||
suffix='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')) }}
|
||||
{{ edit_field(
|
||||
'Change',
|
||||
url_for('.user_profile_password'),
|
||||
suffix='password'
|
||||
)
|
||||
}}
|
||||
{% endcall %}
|
||||
|
||||
{% if current_user.can_use_webauthn %}
|
||||
@@ -52,7 +72,12 @@
|
||||
('{} registered'.format(current_user.webauthn_credentials|length)) if current_user.webauthn_credentials else None,
|
||||
default='None registered'
|
||||
) }}
|
||||
{{ edit_field('Change', url_for('.user_profile_security_keys')) }}
|
||||
{{ edit_field(
|
||||
'Change',
|
||||
url_for('.user_profile_security_keys'),
|
||||
suffix='security keys'
|
||||
)
|
||||
}}
|
||||
{% endcall %}
|
||||
{% endif %}
|
||||
|
||||
@@ -60,7 +85,12 @@
|
||||
{% call row(id='disable-platform-admin') %}
|
||||
{{ text_field('Use platform admin view') }}
|
||||
{{ text_field('Yes' if not session.get('disable_platform_admin_view') else 'No') }}
|
||||
{{ edit_field('Change', url_for('.user_profile_disable_platform_admin_view')) }}
|
||||
{{ edit_field(
|
||||
'Change',
|
||||
url_for('.user_profile_disable_platform_admin_view'),
|
||||
suffix='whether to use platform admin view'
|
||||
)
|
||||
}}
|
||||
{% endcall %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -36,13 +36,14 @@ def test_overview_page_shows_disable_for_platform_admin(
|
||||
page = client_request.get('main.user_profile')
|
||||
assert page.select_one('h1').text.strip() == 'Your profile'
|
||||
disable_platform_admin_row = page.select_one('#disable-platform-admin')
|
||||
assert ' '.join(disable_platform_admin_row.text.split()) == 'Use platform admin view Yes Change'
|
||||
assert ' '.join(disable_platform_admin_row.text.split()) == \
|
||||
'Use platform admin view Yes Change whether to use platform admin view'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('key_count, expected_row_text', [
|
||||
(0, 'Security keys None registered Change'),
|
||||
(1, 'Security keys 1 registered Change'),
|
||||
(2, 'Security keys 2 registered Change'),
|
||||
(0, 'Security keys None registered Change security keys'),
|
||||
(1, 'Security keys 1 registered Change security keys'),
|
||||
(2, 'Security keys 2 registered Change security keys'),
|
||||
])
|
||||
def test_overview_page_shows_security_keys_if_user_they_can_use_webauthn(
|
||||
mocker,
|
||||
|
||||
Reference in New Issue
Block a user