Skip to content

Commit

Permalink
Update the zoom.py exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaAutumn committed Dec 21, 2023
1 parent 08a6267 commit d7533d0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions backend/src/appointment/l10n/en/main.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion backend/src/appointment/routes/schedule.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from fastapi import APIRouter, Depends, HTTPException, Body
from fastapi import APIRouter, Depends, Body
import logging
import os

Expand Down
5 changes: 3 additions & 2 deletions backend/src/appointment/routes/zoom.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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'])
Expand Down

0 comments on commit d7533d0

Please sign in to comment.