aboutsummaryrefslogtreecommitdiff
path: root/jb/views/auth.py
diff options
context:
space:
mode:
authorMax Nanis2026-09-11 18:16:06 -0700
committerMax Nanis2026-09-11 18:16:06 -0700
commit11d63b171501b9c29398133b795c3bcc1ae85a1b (patch)
tree9ef60f1723357889f8bd72420a0c6f7ae5153fa1 /jb/views/auth.py
parentedff9381275d90d7be5f078430554ae592a27f5d (diff)
downloadamt-jb-11d63b171501b9c29398133b795c3bcc1ae85a1b.tar.gz
amt-jb-11d63b171501b9c29398133b795c3bcc1ae85a1b.zip
using RTK with session login. start of magic token request
Diffstat (limited to 'jb/views/auth.py')
-rw-r--r--jb/views/auth.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/jb/views/auth.py b/jb/views/auth.py
index bf39b51..ce9c1e0 100644
--- a/jb/views/auth.py
+++ b/jb/views/auth.py
@@ -2,7 +2,7 @@ from typing import Annotated
from urllib.parse import urlencode
from fastapi import APIRouter, Depends, HTTPException, Response, status
-from fastapi.responses import HTMLResponse, JSONResponse, RedirectResponse
+from fastapi.responses import HTMLResponse, RedirectResponse
from jb.api.auth import (
SESSION_COOKIE_NAME,
@@ -119,7 +119,7 @@ def link_amt_account(body: AmtAccountLink) -> dict[str, str]:
return {}
-@auth_router.get("/link-amt/", response_class=HTMLResponse, include_in_schema=False)
+@auth_router.get("/debug/", response_class=HTMLResponse, include_in_schema=False)
def link_amt_account_landing_page(
gr_api: Annotated[GRApiManager, Depends(get_gr_api_manager)],
token: str | None = None,
@@ -129,13 +129,15 @@ def link_amt_account_landing_page(
# TODO! Try catch any of this, and if it fails, show the user a
# TODO! failed HTML page. As of now, it shows them a failed JSON response.
- if token is None:
- raise HTTPException(
- status_code=status.HTTP_400_BAD_REQUEST,
- detail="token is required",
- )
- _response = RedirectResponse(url="/", status_code=status.HTTP_303_SEE_OTHER)
- _exchange_amt_account_link(token=token, response=_response, gr_api=gr_api)
+ if settings.debug:
+ if token is None:
+ raise HTTPException(
+ status_code=status.HTTP_400_BAD_REQUEST,
+ detail="token is required",
+ )
+
+ _response = RedirectResponse(url="/", status_code=status.HTTP_303_SEE_OTHER)
+ _exchange_amt_account_link(token=token, response=_response, gr_api=gr_api)
return HTMLResponse(
BASE_HTML,