From 9c34d2cd0fa93f8564ab61e0bc550e276ea6a61c Mon Sep 17 00:00:00 2001 From: Sam Der Date: Mon, 18 Dec 2023 11:09:16 -0800 Subject: [PATCH] Revert "Temporarily replace guest token email with print" (#144) This reverts commit 7bd7405ef8f9415328ce05df53b309d71f71edd1. --- apps/api/src/auth/guest_auth.py | 6 ++---- apps/api/tests/test_guest.py | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/api/src/auth/guest_auth.py b/apps/api/src/auth/guest_auth.py index a054d627..2f4196bc 100644 --- a/apps/api/src/auth/guest_auth.py +++ b/apps/api/src/auth/guest_auth.py @@ -11,8 +11,7 @@ from auth.user_identity import GuestUser, utc_now from services import mongodb_handler from services.mongodb_handler import BaseRecord, Collection - -# from utils import email_handler +from utils import email_handler AUTH_KEY_SALT = os.getenv("AUTH_KEY_SALT", "")[:16].encode() PASSPHRASE_LENGTH = 4 @@ -51,8 +50,7 @@ async def initiate_guest_login(email: EmailStr) -> Optional[str]: ) await _save_guest_key(guest) - print(email, passphrase) - # await email_handler.send_guest_login_email(email, passphrase) + await email_handler.send_guest_login_email(email, passphrase) return confirmation diff --git a/apps/api/tests/test_guest.py b/apps/api/tests/test_guest.py index e4b65c6a..f5f5ff7a 100644 --- a/apps/api/tests/test_guest.py +++ b/apps/api/tests/test_guest.py @@ -63,9 +63,9 @@ def test_guest_login_initiation( ), ) ) - # mock_send_guest_login_email.assert_awaited_once_with( - # SAMPLE_EMAIL, SAMPLE_PASSPHRASE - # ) + mock_send_guest_login_email.assert_awaited_once_with( + SAMPLE_EMAIL, SAMPLE_PASSPHRASE + ) assert res.status_code == 303 assert res.headers["location"] == "/guest-login?email=beaver%40caltech.edu"