From 1ab1bf11a696c139acef440b33c599f79bb5039d Mon Sep 17 00:00:00 2001 From: colts661 Date: Fri, 26 Jan 2024 12:56:03 -0800 Subject: [PATCH 1/3] Added AuthRocket Status --- microsetta_interface/implementation.py | 11 +++++++++-- microsetta_interface/templates/admin_home.jinja2 | 10 ++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/microsetta_interface/implementation.py b/microsetta_interface/implementation.py index 283b6755..283d8f50 100644 --- a/microsetta_interface/implementation.py +++ b/microsetta_interface/implementation.py @@ -2782,8 +2782,15 @@ def get_interactive_account_search(email_query): if do_return: return email_diagnostics - accounts = [{"email": acct['email'], "account_id": acct['id']} - for acct in email_diagnostics['accounts']] + accounts = [{ + "email": acct['email'], + "account_id": acct['id'], + "authrocket_status": ( + "Missing" + if acct['auth_issuer'] is None and acct['auth_sub'] is None + else "Authenticated" + ) + } for acct in email_diagnostics['accounts']] return _render_with_defaults('admin_home.jinja2', accounts=accounts) diff --git a/microsetta_interface/templates/admin_home.jinja2 b/microsetta_interface/templates/admin_home.jinja2 index 63732742..2fc24326 100644 --- a/microsetta_interface/templates/admin_home.jinja2 +++ b/microsetta_interface/templates/admin_home.jinja2 @@ -13,18 +13,24 @@
{{ _('Account ID') }}
+
+ {{ _('AuthRocket Status') }} +
{% for account in accounts %}
-
+ -
+
{{ account.account_id|e }}
+
+ {{ account.authrocket_status|e }} +
{% endfor %} From 2649911da2d9aa1c4984215974759277f4e42409 Mon Sep 17 00:00:00 2001 From: colts661 Date: Fri, 26 Jan 2024 13:14:40 -0800 Subject: [PATCH 2/3] simplify comprehension --- microsetta_interface/implementation.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/microsetta_interface/implementation.py b/microsetta_interface/implementation.py index 283d8f50..e659ac4c 100644 --- a/microsetta_interface/implementation.py +++ b/microsetta_interface/implementation.py @@ -2782,15 +2782,20 @@ def get_interactive_account_search(email_query): if do_return: return email_diagnostics - accounts = [{ - "email": acct['email'], - "account_id": acct['id'], - "authrocket_status": ( + accounts = [] + for acct in email_diagnostics['accounts']: + authrocket_status = ( "Missing" if acct['auth_issuer'] is None and acct['auth_sub'] is None else "Authenticated" ) - } for acct in email_diagnostics['accounts']] + acct_diag = { + "email": acct['email'], + "account_id": acct['id'], + "authrocket_status": authrocket_status + } + accounts.append(acct_diag) + return _render_with_defaults('admin_home.jinja2', accounts=accounts) From 62649a937ec30b8e2c26524118356719c1b1370e Mon Sep 17 00:00:00 2001 From: colts661 Date: Mon, 29 Jan 2024 13:48:14 -0800 Subject: [PATCH 3/3] cleaned code; updated logic --- microsetta_interface/implementation.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/microsetta_interface/implementation.py b/microsetta_interface/implementation.py index e659ac4c..1000a14b 100644 --- a/microsetta_interface/implementation.py +++ b/microsetta_interface/implementation.py @@ -2784,11 +2784,12 @@ def get_interactive_account_search(email_query): accounts = [] for acct in email_diagnostics['accounts']: - authrocket_status = ( - "Missing" - if acct['auth_issuer'] is None and acct['auth_sub'] is None - else "Authenticated" - ) + if acct['auth_issuer'] is None and acct['auth_sub'] is None: + authrocket_status = "Missing" + elif acct['auth_issuer'] is None or acct['auth_sub'] is None: + authrocket_status = "Faulty - Contact Admin" + else: + authrocket_status = "Authenticated" acct_diag = { "email": acct['email'], "account_id": acct['id'],