From d7533d034caa8d558aea5335d34949ce09acc6bb Mon Sep 17 00:00:00 2001 From: Melissa Autumn Date: Thu, 21 Dec 2023 10:43:35 -0800 Subject: [PATCH] Update the zoom.py exceptions --- backend/src/appointment/l10n/en/main.ftl | 1 + backend/src/appointment/routes/schedule.py | 2 +- backend/src/appointment/routes/zoom.py | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/appointment/l10n/en/main.ftl b/backend/src/appointment/l10n/en/main.ftl index fe61db3a9..a4671b52f 100644 --- a/backend/src/appointment/l10n/en/main.ftl +++ b/backend/src/appointment/l10n/en/main.ftl @@ -37,6 +37,7 @@ slot-invalid-email = The email you have provided was not valid. Please try again email-mismatch = Email mismatch. invalid-credentials = The provided credentials are not valid. +oauth-error = There was an error with the authentication flow. Please try again. ## Zoom Exceptions diff --git a/backend/src/appointment/routes/schedule.py b/backend/src/appointment/routes/schedule.py index 1fe583b99..1ea032204 100644 --- a/backend/src/appointment/routes/schedule.py +++ b/backend/src/appointment/routes/schedule.py @@ -1,5 +1,5 @@ -from fastapi import APIRouter, Depends, HTTPException, Body +from fastapi import APIRouter, Depends, Body import logging import os diff --git a/backend/src/appointment/routes/zoom.py b/backend/src/appointment/routes/zoom.py index 3e180121a..0c54d50f8 100644 --- a/backend/src/appointment/routes/zoom.py +++ b/backend/src/appointment/routes/zoom.py @@ -12,6 +12,7 @@ from ..dependencies.auth import get_subscriber from ..dependencies.database import get_db from ..dependencies.zoom import get_zoom_client +from ..l10n import l10n router = APIRouter() @@ -41,9 +42,9 @@ def zoom_callback( db=Depends(get_db), ): if 'zoom_state' not in request.session or request.session['zoom_state'] != state: - raise HTTPException(400, "Invalid state.") + raise HTTPException(400, l10n('oauth-error')) if 'zoom_user_id' not in request.session or 'zoom_user_id' == '': - raise HTTPException(400, "User ID could not be retrieved.") + raise HTTPException(400, l10n('oauth-error')) # Retrieve the user id set at the start of the zoom oauth process subscriber = repo.get_subscriber(db, request.session['zoom_user_id'])