change session_id to auth token sub
This commit is contained in:
19
app/main.py
19
app/main.py
@@ -48,17 +48,20 @@ app.mount("/static", StaticFiles(directory="static"), name="static")
|
|||||||
templates = Jinja2Templates(directory="templates")
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|
||||||
|
|
||||||
|
#@app.get("/")
|
||||||
|
#async def root(request: Request) -> HTMLResponse:
|
||||||
|
# return templates.TemplateResponse(
|
||||||
|
# request=request, name="landing.html"
|
||||||
|
# )
|
||||||
|
|
||||||
|
|
||||||
@app.get("/")
|
@app.get("/")
|
||||||
async def root(request: Request) -> HTMLResponse:
|
async def vote(request: Request, session_id: str | None = None , unordered: bool = False, user=Security(get_current_user, scopes=[]),
|
||||||
return templates.TemplateResponse(
|
|
||||||
request=request, name="landing.html"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@app.get("/vote")
|
|
||||||
async def vote(request: Request, session_id: str, unordered: bool = False, user = Security(get_current_user, scopes=[]),
|
|
||||||
db: Session = Depends(get_db)) -> HTMLResponse:
|
db: Session = Depends(get_db)) -> HTMLResponse:
|
||||||
|
|
||||||
|
if not session_id:
|
||||||
|
session_id = user["sub"]
|
||||||
|
|
||||||
print(user)
|
print(user)
|
||||||
|
|
||||||
veto_mode = get_setting(db, "veto_mode")
|
veto_mode = get_setting(db, "veto_mode")
|
||||||
|
|||||||
Reference in New Issue
Block a user