Files
notifications-admin/app/templates/views/user-profile.html
Ben Thorner 4c2915ce86 Use API flag to give users access to WebAuthn
This allows us to roll out the feature to other users. Note that
the flag is also "True" if the user has "webauthn_auth" as their
auth type, so this is compatible with the more fine-grained check
we have on the authentication parts of the feature. We could do a
more explicit "can_use_webauthn or webauthn_auth" check here, but
the idea is that we'll be able to get rid of this flag eventually,
so I've optimised for brevity instead.

I've modified a couple of the unhappy-path tests to make it more
explicit that the flag is false, since it can be true for Platform
Admins and "normal users" alike.
2021-07-07 15:04:48 +01:00

71 lines
2.4 KiB
HTML

{% 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 with context %}
{% block per_page_title %}
Your profile
{% endblock %}
{% block maincolumn_content %}
<h1 class="heading-large">Your profile</h1>
<div class="body-copy-table">
{% call mapping_table(
caption='Your profile',
field_headings=['Label', 'Value', 'Action'],
field_headings_visible=False,
caption_visible=False
) %}
{% call row() %}
{{ text_field('Name') }}
{{ text_field(current_user.name) }}
{{ edit_field('Change', url_for('.user_profile_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')) }}
{% else %}
{{ 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 %}
{% if current_user.can_use_webauthn %}
{% call row(id='security-keys') %}
{{ text_field('Security keys') }}
{{ optional_text_field(
('{} 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')) }}
{% endcall %}
{% endif %}
{% if current_user.platform_admin or session.get('disable_platform_admin_view') %}
{% 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')) }}
{% endcall %}
{% endif %}
{% endcall %}
</div>
{% endblock %}