diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index 79bf77fd2..be97a83c6 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -77,7 +77,9 @@ def send_sms_to_provider(notification): notification.job_row_number, ) except BaseException: - my_phone = redis_store.get(f"2facode_{notification.id}") + key = f"2facode-{notification.id}".replace(" ", "") + my_phone = redis_store.get(key) + if my_phone: my_phone = my_phone.decode("utf-8") if my_phone is None: diff --git a/app/user/rest.py b/app/user/rest.py index 7941504ee..d9b23a677 100644 --- a/app/user/rest.py +++ b/app/user/rest.py @@ -351,7 +351,14 @@ def create_2fa_code( reply_to_text=reply_to, ) - redis_store.set(f"2facode_{saved_notification.id}", recipient, ex=1800) + key = f"2facode-{saved_notification.id}".replace(" ", "") + recipient = str(recipient) + redis_store.set(key, recipient) + stored_recipient = redis_store.get(key) + if stored_recipient: + current_app.logger.info("IN user/rest.py we saved the recipient of the 2facode to redis!") + else: + current_app.logger.info("IN user/rest.py we did NOT save the recipient of the 2facode to redis!") # Assume that we never want to observe the Notify service's research mode # setting for this notification - we still need to be able to log into the # admin even if we're doing user research using this service: