2024-04-24 12:31:00 -07:00
|
|
|
|
{% extends "base.html" %}
|
2021-05-07 15:00:01 +01:00
|
|
|
|
{% from "components/page-header.html" import page_header %}
|
2023-08-30 11:07:38 -04:00
|
|
|
|
{% from "components/components/button/macro.njk" import usaButton %}
|
|
|
|
|
|
{% from "components/components/back-link/macro.njk" import usaBackLink %}
|
2021-05-14 12:40:24 +01:00
|
|
|
|
{% from "components/table.html" import edit_field, mapping_table, row, field, row_heading %}
|
2021-05-18 12:38:05 +01:00
|
|
|
|
{% from "components/webauthn-api-check.html" import webauthn_api_check %}
|
2023-08-31 10:36:29 -04:00
|
|
|
|
{% from "components/components/error-message/macro.njk" import usaErrorMessage %}
|
2021-05-07 15:00:01 +01:00
|
|
|
|
|
|
|
|
|
|
{% set page_title = 'Security keys' %}
|
|
|
|
|
|
{% set credentials = current_user.webauthn_credentials %}
|
|
|
|
|
|
|
2021-05-18 12:38:05 +01:00
|
|
|
|
{% block extra_javascripts_before_body %}
|
|
|
|
|
|
{{ webauthn_api_check() }}
|
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
2021-05-07 15:00:01 +01:00
|
|
|
|
{% block per_page_title %}
|
|
|
|
|
|
{{ page_title }}
|
|
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
2021-07-30 14:42:54 +01:00
|
|
|
|
{% block backLink %}
|
2023-08-30 11:07:38 -04:00
|
|
|
|
{{ usaBackLink({ "href": url_for('.user_profile') }) }}
|
2021-07-30 14:42:54 +01:00
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
2021-05-07 15:00:01 +01:00
|
|
|
|
{% block maincolumn_content %}
|
|
|
|
|
|
|
2021-05-28 13:55:31 +01:00
|
|
|
|
{% set webauthn_button %}
|
2023-08-30 11:07:38 -04:00
|
|
|
|
{{ usaButton({
|
2021-05-28 13:55:31 +01:00
|
|
|
|
"element": "button",
|
|
|
|
|
|
"text": "Register a key",
|
|
|
|
|
|
"classes": "govuk-button--secondary webauthn__api-required",
|
|
|
|
|
|
"attributes": {
|
|
|
|
|
|
"data-module": "register-security-key",
|
|
|
|
|
|
"data-csrf-token": csrf_token(),
|
|
|
|
|
|
}
|
|
|
|
|
|
}) }}
|
|
|
|
|
|
|
2023-08-31 10:36:29 -04:00
|
|
|
|
{{ usaErrorMessage({
|
2021-05-28 13:55:31 +01:00
|
|
|
|
"classes": "webauthn__api-missing",
|
|
|
|
|
|
"text": "Your browser does not support security keys. Try signing in to Notify using a different browser."
|
|
|
|
|
|
}) }}
|
|
|
|
|
|
|
2023-08-31 10:36:29 -04:00
|
|
|
|
{{ usaErrorMessage({
|
2021-05-28 13:55:31 +01:00
|
|
|
|
"classes": "webauthn__no-js",
|
|
|
|
|
|
"text": "JavaScript is not available for this page. Security keys need JavaScript to work."
|
|
|
|
|
|
}) }}
|
|
|
|
|
|
{% endset %}
|
|
|
|
|
|
|
2023-08-23 16:18:25 -04:00
|
|
|
|
<div class="grid-row">
|
2021-08-11 18:02:50 +01:00
|
|
|
|
|
2023-08-31 10:36:29 -04:00
|
|
|
|
{{ usaErrorMessage({
|
2023-08-25 10:40:56 -04:00
|
|
|
|
"classes": "banner-dangerous display-none",
|
2021-09-13 16:31:58 +01:00
|
|
|
|
"html": (
|
|
|
|
|
|
'There’s a problem with your security key' +
|
2023-06-06 15:28:24 -04:00
|
|
|
|
'<p>Check you have the right key and try again. ' +
|
2021-09-13 16:31:58 +01:00
|
|
|
|
'If this does not work, ' +
|
2023-08-08 16:19:17 -04:00
|
|
|
|
'<a class="usa-link" href=' + url_for('main.support') + ">contact us</a>." +
|
2021-09-13 16:31:58 +01:00
|
|
|
|
'</p>'
|
|
|
|
|
|
),
|
2021-08-11 18:02:50 +01:00
|
|
|
|
"attributes": {
|
|
|
|
|
|
"aria-live": "polite",
|
|
|
|
|
|
"tabindex": '-1'
|
|
|
|
|
|
}
|
|
|
|
|
|
}) }}
|
|
|
|
|
|
|
2021-05-27 17:29:28 +01:00
|
|
|
|
{% if credentials %}
|
2023-08-23 16:18:25 -04:00
|
|
|
|
<div class="grid-col-10">
|
2021-05-28 16:19:17 +01:00
|
|
|
|
{{ page_header(page_title) }}
|
2021-05-14 12:40:24 +01:00
|
|
|
|
<div class="body-copy-table">
|
|
|
|
|
|
{% call mapping_table(
|
|
|
|
|
|
caption=page_title,
|
|
|
|
|
|
field_headings=['Security key details', 'Action'],
|
|
|
|
|
|
field_headings_visible=False,
|
|
|
|
|
|
caption_visible=False,
|
|
|
|
|
|
) %}
|
|
|
|
|
|
{% for credential in credentials %}
|
|
|
|
|
|
{% call row() %}
|
|
|
|
|
|
{% call field() %}
|
2023-08-25 11:49:13 -04:00
|
|
|
|
<div class="usa-body">{{ credential.name }}</div>
|
|
|
|
|
|
<div class="usa-body hint">Registered {{ credential.created_at|format_delta }}</div>
|
2021-05-14 12:40:24 +01:00
|
|
|
|
{% endcall %}
|
|
|
|
|
|
{{ edit_field('Manage', url_for('.user_profile_manage_security_key', key_id=credential.id)) }}
|
2021-05-07 15:00:01 +01:00
|
|
|
|
{% endcall %}
|
2021-05-14 12:40:24 +01:00
|
|
|
|
{% endfor %}
|
|
|
|
|
|
{% endcall %}
|
|
|
|
|
|
</div>
|
2021-05-28 13:55:31 +01:00
|
|
|
|
{{ webauthn_button }}
|
2021-05-27 17:29:28 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
{% else %}
|
2023-08-23 16:18:25 -04:00
|
|
|
|
<div class="grid-col-6">
|
2021-05-27 17:29:28 +01:00
|
|
|
|
{{ page_header(page_title) }}
|
2023-06-06 15:28:24 -04:00
|
|
|
|
<p>
|
2021-05-27 17:29:28 +01:00
|
|
|
|
Security keys are an alternative way of signing in to Notify,
|
|
|
|
|
|
instead of getting a code in a text message
|
|
|
|
|
|
</p>
|
2023-06-06 15:28:24 -04:00
|
|
|
|
<p>
|
2021-05-27 17:29:28 +01:00
|
|
|
|
You can buy any key that’s compatible with the WebAuthn
|
|
|
|
|
|
standard.
|
2021-05-07 15:00:01 +01:00
|
|
|
|
</p>
|
2021-05-28 13:55:31 +01:00
|
|
|
|
{{ webauthn_button }}
|
2021-05-27 17:29:28 +01:00
|
|
|
|
</div>
|
2023-08-23 16:18:25 -04:00
|
|
|
|
<div class="grid-col-3">
|
2022-01-12 12:20:27 +00:00
|
|
|
|
<img src="{{ asset_url('images/security-key.svg') }}" alt="" class="webauthn-illustration" width="149" height="150">
|
2021-05-27 17:29:28 +01:00
|
|
|
|
</div>
|
2021-05-28 13:52:05 +01:00
|
|
|
|
{% endif %}
|
2021-05-27 17:29:28 +01:00
|
|
|
|
</div>
|
2021-05-07 15:00:01 +01:00
|
|
|
|
</div>
|
|
|
|
|
|
{% endblock %}
|