From 7447a0080cba26390977b2fd18ad5b115e06dab7 Mon Sep 17 00:00:00 2001 From: alexjanousekGSA Date: Wed, 2 Jul 2025 15:25:57 -0400 Subject: [PATCH] Removed unused code that is not fully implemented --- app/assets/images/security-key.svg | 73 ------------ app/main/forms.py | 11 -- app/templates/views/two-factor-webauthn.html | 71 ------------ .../user-profile/manage-security-key.html | 34 ------ .../views/user-profile/security-keys.html | 107 ------------------ 5 files changed, 296 deletions(-) delete mode 100644 app/assets/images/security-key.svg delete mode 100644 app/templates/views/two-factor-webauthn.html delete mode 100644 app/templates/views/user-profile/manage-security-key.html delete mode 100644 app/templates/views/user-profile/security-keys.html diff --git a/app/assets/images/security-key.svg b/app/assets/images/security-key.svg deleted file mode 100644 index f848b7a89..000000000 --- a/app/assets/images/security-key.svg +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/app/main/forms.py b/app/main/forms.py index 2695fcdc4..a269bc385 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -1890,14 +1890,3 @@ class AdminClearCacheForm(StripWhitespaceForm): def validate_model_type(self, field): if not field.data: raise ValidationError("Select at least one option") - - -class ChangeSecurityKeyNameForm(StripWhitespaceForm): - security_key_name = GovukTextInputField( - "Name of key", - validators=[ - DataRequired(message="Cannot be empty"), - MustContainAlphanumericCharacters(), - Length(max=255, message="Name of key must be 255 characters or fewer"), - ], - ) diff --git a/app/templates/views/two-factor-webauthn.html b/app/templates/views/two-factor-webauthn.html deleted file mode 100644 index 09b64bf8d..000000000 --- a/app/templates/views/two-factor-webauthn.html +++ /dev/null @@ -1,71 +0,0 @@ -{% extends "base.html" %} -{% from "components/page-header.html" import page_header %} -{% from "components/components/button/macro.njk" import usaButton %} -{% from "components/components/back-link/macro.njk" import usaBackLink %} -{% from "components/webauthn-api-check.html" import webauthn_api_check %} -{% from "components/components/error-message/macro.njk" import usaErrorMessage %} - -{% set page_title = 'Get your security key' %} - -{% block extra_javascripts_before_body %} - {{ webauthn_api_check() }} -{% endblock %} - -{% block per_page_title %} - {{ page_title }} -{% endblock %} - -{% block backLink %} - {{ usaBackLink({ "href": url_for('.user_profile') }) }} -{% endblock %} - -{% block maincolumn_content %} - - {{ usaErrorMessage({ - "classes": "banner-dangerous display-none", - "html": ( - 'There’s a problem with your security key' + - '

Check you have the right key and try again. ' + - 'If this does not work, ' + - 'contact us." + - '

' - ), - "attributes": { - "aria-live": "polite", - "tabindex": '-1' - } - }) }} - -
-
- {{ page_header(page_title) }} - -

- You need to have your security key to sign in. -

- - {{ usaButton({ - "element": "button", - "text": "Check security key", - "classes": "govuk-button--secondary webauthn__api-required", - "attributes": { - "data-module": "authenticate-security-key", - "data-csrf-token": csrf_token(), - } - }) }} - - {{ usaErrorMessage({ - "classes": "webauthn__api-missing", - "text": "Your browser does not support security keys. Try signing in to Notify using a different browser." - }) }} - - {{ usaErrorMessage({ - "classes": "webauthn__no-js", - "text": "JavaScript is not available for this page. Security keys need JavaScript to work." - }) }} -
-
- -
-
-{% endblock %} diff --git a/app/templates/views/user-profile/manage-security-key.html b/app/templates/views/user-profile/manage-security-key.html deleted file mode 100644 index 5026ce451..000000000 --- a/app/templates/views/user-profile/manage-security-key.html +++ /dev/null @@ -1,34 +0,0 @@ -{% extends "base.html" %} -{% from "components/page-header.html" import page_header %} -{% from "components/page-footer.html" import page_footer %} -{% from "components/form.html" import form_wrapper %} -{% from "components/components/back-link/macro.njk" import usaBackLink %} - -{% set page_title = 'Manage ' + '‘' + security_key.name + '’' %} - -{% block per_page_title %} - {{ page_title }} -{% endblock %} - -{% block backLink %} - {{ usaBackLink({ "href": url_for('.user_profile_security_keys') }) }} -{% endblock %} - -{% block maincolumn_content %} - {{ page_header(page_title) }} - -
-
- {% call form_wrapper(autocomplete=True) %} - {{ form.security_key_name }} - {{ page_footer( - 'Save', - delete_link=url_for( - '.user_profile_confirm_delete_security_key', key_id=security_key.id), - delete_link_text='Delete' - ) }} - {% endcall %} -
-
- -{% endblock %} diff --git a/app/templates/views/user-profile/security-keys.html b/app/templates/views/user-profile/security-keys.html deleted file mode 100644 index 873ec681f..000000000 --- a/app/templates/views/user-profile/security-keys.html +++ /dev/null @@ -1,107 +0,0 @@ -{% extends "base.html" %} -{% from "components/page-header.html" import page_header %} -{% from "components/components/button/macro.njk" import usaButton %} -{% from "components/components/back-link/macro.njk" import usaBackLink %} -{% from "components/table.html" import edit_field, mapping_table, row, field, row_heading %} -{% from "components/webauthn-api-check.html" import webauthn_api_check %} -{% from "components/components/error-message/macro.njk" import usaErrorMessage %} - -{% set page_title = 'Security keys' %} -{% set credentials = current_user.webauthn_credentials %} - -{% block extra_javascripts_before_body %} - {{ webauthn_api_check() }} -{% endblock %} - -{% block per_page_title %} - {{ page_title }} -{% endblock %} - -{% block backLink %} - {{ usaBackLink({ "href": url_for('.user_profile') }) }} -{% endblock %} - -{% block maincolumn_content %} - -{% set webauthn_button %} - {{ usaButton({ - "element": "button", - "text": "Register a key", - "classes": "govuk-button--secondary webauthn__api-required", - "attributes": { - "data-module": "register-security-key", - "data-csrf-token": csrf_token(), - } - }) }} - - {{ usaErrorMessage({ - "classes": "webauthn__api-missing", - "text": "Your browser does not support security keys. Try signing in to Notify using a different browser." - }) }} - - {{ usaErrorMessage({ - "classes": "webauthn__no-js", - "text": "JavaScript is not available for this page. Security keys need JavaScript to work." - }) }} -{% endset %} - -
- - {{ usaErrorMessage({ - "classes": "banner-dangerous display-none", - "html": ( - 'There’s a problem with your security key' + - '

Check you have the right key and try again. ' + - 'If this does not work, ' + - 'contact us." + - '

' - ), - "attributes": { - "aria-live": "polite", - "tabindex": '-1' - } - }) }} - - {% if credentials %} -
- {{ page_header(page_title) }} -
- {% 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() %} -
{{ credential.name }}
-
Registered {{ credential.created_at|format_delta }}
- {% endcall %} - {{ edit_field('Manage', url_for('.user_profile_manage_security_key', key_id=credential.id)) }} - {% endcall %} - {% endfor %} - {% endcall %} -
- {{ webauthn_button }} -
- {% else %} -
- {{ page_header(page_title) }} -

- 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 }} -
-
- -
- {% endif %} -
- -{% endblock %}