From 4a61575859e3abe9fa04cad30eb1c307f383ad40 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 9 Apr 2024 15:28:36 -0700 Subject: [PATCH 01/10] moved settings_nav to /new/components --- .../new/components/settings_navigation.html | 16 ++++++++++++++++ app/templates/new/layouts/withnav_template.html | 4 ++-- app/templates/new/templates_glossary.md | 8 ++++---- 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 app/templates/new/components/settings_navigation.html diff --git a/app/templates/new/components/settings_navigation.html b/app/templates/new/components/settings_navigation.html new file mode 100644 index 000000000..d94c417e7 --- /dev/null +++ b/app/templates/new/components/settings_navigation.html @@ -0,0 +1,16 @@ +{% if help %} +{% include 'partials/tour.html' %} +{% else %} + +{% endif %} diff --git a/app/templates/new/layouts/withnav_template.html b/app/templates/new/layouts/withnav_template.html index 412a004d0..73965df18 100644 --- a/app/templates/new/layouts/withnav_template.html +++ b/app/templates/new/layouts/withnav_template.html @@ -9,7 +9,7 @@ {% block serviceNavigation %} {% include "service_navigation.html" %} {% endblock %} - +
{% if help %}
@@ -18,7 +18,7 @@ {% endif %} {% block sideNavigation %} {% include "main_nav.html" %} - + {% endblock %}
{% if help %} diff --git a/app/templates/new/templates_glossary.md b/app/templates/new/templates_glossary.md index 04f2c4151..9cad3d101 100644 --- a/app/templates/new/templates_glossary.md +++ b/app/templates/new/templates_glossary.md @@ -30,9 +30,9 @@ This document serves as a glossary for the templates directory structure of the - withoutnav_template.html Delete - main_template.html Delete - settings_templates.html `withnav_template` can be used to replace `settings_template`. -- settings_nav.html (move to /new/navigation directory) -- main_nav.html (move to /new/navigation directory) -- service_navigation.html (move to /new/navigation directory) +- settings_nav.html (move to /components/ directory) +- main_nav.html (move to /components/ directory) +- service_navigation.html (move to /components/ directory) - org_template, could be under it's own directory called /layout/organization -- org_nav.html (move to /new/navigation directory) +- org_nav.html (move to /components/ directory) - content_template.html Delete From 35f836e5d6f7bc0e8850d4a116b0a3a6b493ba5e Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 9 Apr 2024 15:57:15 -0700 Subject: [PATCH 02/10] service_navigation.html moved to components --- .../new/components/service_navigation.html | 19 +++++++++++++++++++ .../new/layouts/withnav_template.html | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 app/templates/new/components/service_navigation.html diff --git a/app/templates/new/components/service_navigation.html b/app/templates/new/components/service_navigation.html new file mode 100644 index 000000000..4cd23f252 --- /dev/null +++ b/app/templates/new/components/service_navigation.html @@ -0,0 +1,19 @@ +{% macro navigation_service_name(service) %} +
+ {{ service.name }} + {% if not service.active %} + Suspended + {% endif %} +
+{% endmacro %} + + diff --git a/app/templates/new/layouts/withnav_template.html b/app/templates/new/layouts/withnav_template.html index 412a004d0..7846513a9 100644 --- a/app/templates/new/layouts/withnav_template.html +++ b/app/templates/new/layouts/withnav_template.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "/new/base.html" %} {% block per_page_title %} {% block service_page_title %}{% endblock %} – {{ current_service.name }} @@ -7,7 +7,7 @@ {% block main %}
{% block serviceNavigation %} - {% include "service_navigation.html" %} + {% include "new/components/service_navigation.html" %} {% endblock %}
From d250542b7f8cdf00c68d8cafcc9f7e1562cc02d6 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 9 Apr 2024 16:07:56 -0700 Subject: [PATCH 03/10] converted and moved service_navigation.html to /components --- .../new/components/service_navigation.html | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/app/templates/new/components/service_navigation.html b/app/templates/new/components/service_navigation.html index 4cd23f252..e3826d279 100644 --- a/app/templates/new/components/service_navigation.html +++ b/app/templates/new/components/service_navigation.html @@ -1,12 +1,3 @@ -{% macro navigation_service_name(service) %} -
- {{ service.name }} - {% if not service.active %} - Suspended - {% endif %} -
-{% endmacro %} - From 8915bf16eddc1f8b43355de1ef43a3f122b75b61 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 9 Apr 2024 16:28:05 -0700 Subject: [PATCH 04/10] moved main_nav to components --- app/templates/new/components/main_nav.html | 30 ++++++++++++++++++++++ app/templates/withnav_template.html | 4 +-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 app/templates/new/components/main_nav.html diff --git a/app/templates/new/components/main_nav.html b/app/templates/new/components/main_nav.html new file mode 100644 index 000000000..a3b02823e --- /dev/null +++ b/app/templates/new/components/main_nav.html @@ -0,0 +1,30 @@ +{% if help %} + {% include 'partials/tour.html' %} +{% else %} + +{% endif %} diff --git a/app/templates/withnav_template.html b/app/templates/withnav_template.html index 40d2e10f1..407b69f21 100644 --- a/app/templates/withnav_template.html +++ b/app/templates/withnav_template.html @@ -1,4 +1,4 @@ -{% extends "admin_template.html" %} +{% extends "/new/base.html" %} {% block per_page_title %} {% block service_page_title %}{% endblock %} – {{ current_service.name }} @@ -6,7 +6,7 @@ {% block main %}
- {% include "service_navigation.html" %} + {% include "new/components/service_navigation.html" %}
{% if help %}
From beedce179673aae22904fbb32ec54fca08e530c4 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 9 Apr 2024 16:31:53 -0700 Subject: [PATCH 05/10] moved main_nav to components --- app/templates/new/layouts/withnav_template.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/new/layouts/withnav_template.html b/app/templates/new/layouts/withnav_template.html index 412a004d0..d5fa1acd9 100644 --- a/app/templates/new/layouts/withnav_template.html +++ b/app/templates/new/layouts/withnav_template.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "/new/base.html" %} {% block per_page_title %} {% block service_page_title %}{% endblock %} – {{ current_service.name }} @@ -17,7 +17,7 @@
{% endif %} {% block sideNavigation %} - {% include "main_nav.html" %} + {% include "/new/components/main_nav.html" %} {% endblock %}
From 7f3728e0d5f2702658c2421422c6c1f48881f6fa Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 9 Apr 2024 16:32:56 -0700 Subject: [PATCH 06/10] moved main_nav to components --- app/templates/withnav_template.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/withnav_template.html b/app/templates/withnav_template.html index 407b69f21..40d2e10f1 100644 --- a/app/templates/withnav_template.html +++ b/app/templates/withnav_template.html @@ -1,4 +1,4 @@ -{% extends "/new/base.html" %} +{% extends "admin_template.html" %} {% block per_page_title %} {% block service_page_title %}{% endblock %} – {{ current_service.name }} @@ -6,7 +6,7 @@ {% block main %}
- {% include "new/components/service_navigation.html" %} + {% include "service_navigation.html" %}
{% if help %}
From 7fe90a14aa13d9d0e51c8199df1451bc67abe627 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 9 Apr 2024 16:40:20 -0700 Subject: [PATCH 07/10] org_nav --- app/templates/new/components/org_nav.html | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/templates/new/components/org_nav.html diff --git a/app/templates/new/components/org_nav.html b/app/templates/new/components/org_nav.html new file mode 100644 index 000000000..f7f7a5b93 --- /dev/null +++ b/app/templates/new/components/org_nav.html @@ -0,0 +1,11 @@ + From 5626267c94d49c5f69daa238d7bfe62759d71df6 Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Tue, 9 Apr 2024 16:43:01 -0700 Subject: [PATCH 08/10] org_nav --- app/templates/new/layouts/org_template.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/templates/new/layouts/org_template.html b/app/templates/new/layouts/org_template.html index 5e04003fd..69f49b76a 100644 --- a/app/templates/new/layouts/org_template.html +++ b/app/templates/new/layouts/org_template.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} +{% extends "/new/base.html" %} {% block per_page_title %} {% block org_page_title %}{% endblock %} – {{ current_org.name }} @@ -17,7 +17,7 @@
- {% include "org_nav.html" %} + {% include "/new/components/org_nav.html" %}
{% block beforeContent %} From 460399dd68ad94d89259c8001c02e8ace27ac19c Mon Sep 17 00:00:00 2001 From: Beverly Nguyen Date: Wed, 10 Apr 2024 10:41:35 -0700 Subject: [PATCH 09/10] revised notes --- app/templates/new/templates_glossary.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/templates/new/templates_glossary.md b/app/templates/new/templates_glossary.md index 9cad3d101..1c52e75dc 100644 --- a/app/templates/new/templates_glossary.md +++ b/app/templates/new/templates_glossary.md @@ -14,6 +14,10 @@ This document serves as a glossary for the templates directory structure of the - `head.html`: Template for the site's , included in `base.html`. - `header.html`: Template for the site's header, included in `base.html`. - `footer.html`: Template for the site's footer, included in `base.html`. + - `settings_navigation.html`: The settings navigation used in `withnav_template.html` that previously extended `settings_template.html`. + - `org_nav.html`: The organization's navigation used solely in `org_template.html`. + - `main_nav.html`: The main navigation used in `withnav_template.html` + - `service_navigation.html`: The service navigation used in `withnav_template.html`. In withnav_template.html, the `serviceNavigation` block will be left empty in any child templates that previously extended `settings_template.html`. - **/views** (or **/pages**): Individual page templates that use the base layouts, components, and partials to present content. ### Best Practices From 5538b802ee2be813cffa9f8d52396f48c5f05b3f Mon Sep 17 00:00:00 2001 From: Kenneth Kehl <@kkehl@flexion.us> Date: Wed, 10 Apr 2024 13:17:00 -0700 Subject: [PATCH 10/10] Exception Investigation: builtins:KeyError --- app/main/views/sign_in.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/app/main/views/sign_in.py b/app/main/views/sign_in.py index 402e61a08..6de46b023 100644 --- a/app/main/views/sign_in.py +++ b/app/main/views/sign_in.py @@ -63,6 +63,10 @@ def _get_access_token(code, state): url = f"{base_url}{cli_assert}&{cli_assert_type}&{code_param}&grant_type=authorization_code" headers = {"Authorization": "Bearer %s" % token} response = requests.post(url, headers=headers) + if response.json().get("access_token") is None: + # Capture the response json here so it hopefully shows up in error reports + current_app.logger.error(f"Error when getting access token {response.json()}") + raise KeyError(f"'access_token' {response.json()}") access_token = response.json()["access_token"] return access_token @@ -84,13 +88,17 @@ def _do_login_dot_gov(): code = request.args.get("code") state = request.args.get("state") login_gov_error = request.args.get("error") - if code and state: - access_token = _get_access_token(code, state) - user_email, user_uuid = _get_user_email_and_uuid(access_token) - redirect_url = request.args.get("next") + + if login_gov_error: + current_app.logger.error(f"login.gov error: {login_gov_error}") + raise Exception(f"Could not login with login.gov {login_gov_error}") + elif code and state: # activate the user try: + access_token = _get_access_token(code, state) + user_email, user_uuid = _get_user_email_and_uuid(access_token) + redirect_url = request.args.get("next") user = user_api_client.get_user_by_uuid_or_email(user_uuid, user_email) activate_user(user["id"]) except BaseException as be: # noqa B036 @@ -99,9 +107,6 @@ def _do_login_dot_gov(): return redirect(url_for("main.show_accounts_or_dashboard", next=redirect_url)) - elif login_gov_error: - current_app.logger.error(f"login.gov error: {login_gov_error}") - raise Exception(f"Could not login with login.gov {login_gov_error}") # end login.gov