diff --git a/app/assets/images/security-key.svg b/app/assets/images/security-key.svg new file mode 100644 index 000000000..f848b7a89 --- /dev/null +++ b/app/assets/images/security-key.svg @@ -0,0 +1,73 @@ + + + diff --git a/app/assets/stylesheets/views/webauthn.scss b/app/assets/stylesheets/views/webauthn.scss index 3e0de527e..7f47049b0 100644 --- a/app/assets/stylesheets/views/webauthn.scss +++ b/app/assets/stylesheets/views/webauthn.scss @@ -23,3 +23,13 @@ display: block; } } + +.webauthn-illustration { + + @include media-down(mobile) { + margin: govuk-spacing(6) govuk-spacing(9) 0 govuk-spacing(9); + } + + margin: govuk-spacing(9) auto 0 auto; + +} diff --git a/app/templates/views/user-profile.html b/app/templates/views/user-profile.html index 25f60cf2f..4044a707c 100644 --- a/app/templates/views/user-profile.html +++ b/app/templates/views/user-profile.html @@ -48,7 +48,10 @@ {% if current_user.platform_admin %} {% call row(id='security-keys') %} {{ text_field('Security keys') }} - {{ text_field(current_user.webauthn_credentials|length) }} + {{ 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 %} diff --git a/app/templates/views/user-profile/security-keys.html b/app/templates/views/user-profile/security-keys.html index c1df142a8..95799c710 100644 --- a/app/templates/views/user-profile/security-keys.html +++ b/app/templates/views/user-profile/security-keys.html @@ -18,14 +18,35 @@ {% endblock %} {% block maincolumn_content %} - {{ page_header( - page_title, - back_link=url_for('.user_profile') - ) }} +{% set webauthn_button %} + {{ govukButton({ + "element": "button", + "text": "Register a key", + "classes": "govuk-button--secondary webauthn__api-required", + "attributes": { + "data-module": "register-security-key", + "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." + }) }} +{% endset %} + + + {{ govukBackLink({ "href": url_for('.user_profile') }) }}
- Security keys are an alternative way of signing in to Notify. + Security keys are an alternative way of signing in to Notify, + instead of getting a code in a text message
- ++ You can buy any key that’s compatible with the WebAuthn + standard. +
+ {{ webauthn_button }} +