Skip to content

Commit 342fbf1

Browse files
Don't do repeated errors on Encryption errors from DA
Deletes the entry from the DA store when it can't decrypt it. Still unclear why it's not able to decrypt in the first place, but not able to reproduce the whole thing yet. TODO: still shouldn't do any errors, IMO, bc I don't know how we would fix them?
1 parent c1ca391 commit 342fbf1

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

docassemble/EFSPIntegration/data/questions/login_qs.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,15 @@ code: |
5757
need:
5858
- proxy_conn
5959
- da_store
60+
- tyler_header_name
61+
- tyler_id_name
62+
- sql_header_name
63+
- sql_id_name
6064
code: |
61-
tyler_header_name = f"TYLER-TOKEN-{jurisdiction_id.upper()}"
62-
tyler_id_name = f"TYLER-ID-{jurisdiction_id}"
6365
try:
64-
if da_store.defined("EFSP-" + tyler_header_name):
65-
proxy_conn.proxy_client.headers[tyler_header_name] = da_store.get("EFSP-" + tyler_header_name)
66-
proxy_conn.proxy_client.headers[tyler_id_name] = da_store.get("EFSP-" + tyler_id_name)
66+
if da_store.defined(sql_header_name):
67+
proxy_conn.proxy_client.headers[tyler_header_name] = da_store.get(sql_header_name)
68+
proxy_conn.proxy_client.headers[tyler_id_name] = da_store.get(sql_id_name)
6769
tyler_user = proxy_conn.get_user()
6870
if tyler_user.is_ok():
6971
my_username = tyler_user.data.get('email')
@@ -72,13 +74,16 @@ code: |
7274
logged_in_user_is_admin, logged_in_user_is_global_admin = get_tyler_roles(proxy_conn, None, tyler_user)
7375
tyler_login = True
7476
else:
75-
da_store.set("EFSP-" + tyler_header_name, '')
76-
da_store.set(tyler_user_id_key, '')
77+
da_store.delete(sql_header_name)
78+
da_store.delete(sql_id_name)
7779
except NameError as err:
7880
# Re-raise only name errors, so DA can work correctly
7981
raise err
8082
except Exception as ex:
8183
log_error_and_notify(f"Error when trying to get da_store Tyler token: {ex}")
84+
# Don't try it again
85+
da_store.delete(sql_header_name)
86+
da_store.delete(sql_id_name)
8287
---
8388
id: login with redis
8489
continue button field: continue_stored_login
@@ -95,6 +100,13 @@ fields:
95100
- No, I want to use a different login email.: False
96101
---
97102
code: |
103+
tyler_header_name = f"TYLER-TOKEN-{jurisdiction_id.upper()}"
104+
tyler_id_name = f"TYLER-ID-{jurisdiction_id.upper()}"
105+
sql_header_name = "EFSP-" + tyler_header_name
106+
sql_id_name = "EFSP-" + tyler_id_name
107+
---
108+
code: |
109+
# Leaving in until MAPetitionToSealEviction is refactored
98110
tyler_user_id_key = f"EFSP-TYLER-ID-{jurisdiction_id.lower()}"
99111
---
100112
only sets:

0 commit comments

Comments
 (0)