mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Show an error if user cannot login with WebAuthn
This follows the same approach as for registration [1]. None of this code is tested, as: - We don't have a way to test inline JS. - The risk of this code not working is low. - We might change the approach in future [2]. [1]: https://github.com/alphagov/notifications-admin/pull/3886 [2]: https://github.com/alphagov/notifications-admin/pull/3886#issuecomment-841128380
This commit is contained in:
@@ -2,9 +2,15 @@
|
|||||||
{% from "components/page-header.html" import page_header %}
|
{% from "components/page-header.html" import page_header %}
|
||||||
{% from "components/button/macro.njk" import govukButton %}
|
{% from "components/button/macro.njk" import govukButton %}
|
||||||
{% from "components/back-link/macro.njk" import govukBackLink %}
|
{% from "components/back-link/macro.njk" import govukBackLink %}
|
||||||
|
{% from "components/webauthn-api-check.html" import webauthn_api_check %}
|
||||||
|
{% from "vendor/govuk-frontend/components/error-message/macro.njk" import govukErrorMessage %}
|
||||||
|
|
||||||
{% set page_title = 'Get your security key' %}
|
{% set page_title = 'Get your security key' %}
|
||||||
|
|
||||||
|
{% block extra_javascripts_before_body %}
|
||||||
|
{{ webauthn_api_check() }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block per_page_title %}
|
{% block per_page_title %}
|
||||||
{{ page_title }}
|
{{ page_title }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -15,18 +21,30 @@
|
|||||||
<div class="govuk-grid-row">
|
<div class="govuk-grid-row">
|
||||||
<div class="govuk-grid-column-one-half">
|
<div class="govuk-grid-column-one-half">
|
||||||
{{ page_header(page_title) }}
|
{{ page_header(page_title) }}
|
||||||
|
|
||||||
<p class="govuk-body">
|
<p class="govuk-body">
|
||||||
You need to have your security key to sign in.
|
You need to have your security key to sign in.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{{ govukButton({
|
{{ govukButton({
|
||||||
"element": "button",
|
"element": "button",
|
||||||
"text": "Check security key",
|
"text": "Check security key",
|
||||||
"classes": "govuk-button--secondary",
|
"classes": "govuk-button--secondary webauthn__api-required",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"data-module": "authenticate-security-key",
|
"data-module": "authenticate-security-key",
|
||||||
"data-csrf-token": csrf_token(),
|
"data-csrf-token": csrf_token(),
|
||||||
}
|
}
|
||||||
}) }}
|
}) }}
|
||||||
|
|
||||||
|
{{ govukErrorMessage({
|
||||||
|
"classes": "webauthn__api-missing",
|
||||||
|
"text": "Your browser does not support security keys. Try signing in to Notify using a different browser."
|
||||||
|
}) }}
|
||||||
|
|
||||||
|
{{ govukErrorMessage({
|
||||||
|
"classes": "webauthn__no-js",
|
||||||
|
"text": "JavaScript is not available for this page. Security keys need JavaScript to work."
|
||||||
|
}) }}
|
||||||
</div>
|
</div>
|
||||||
<div class="govuk-grid-column-one-quarter">
|
<div class="govuk-grid-column-one-quarter">
|
||||||
<img src="{{ asset_url('images/security-key.svg') }}" alt="" class="webauthn-illustration">
|
<img src="{{ asset_url('images/security-key.svg') }}" alt="" class="webauthn-illustration">
|
||||||
|
|||||||
Reference in New Issue
Block a user