mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
change(fastapi): remove the GET /logout route; replaced with POST
Had to add some additional CSS in to style a form button the same as <a> links are styled. Closes #188 Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
44f2366675
commit
69eb17cb0d
4 changed files with 25 additions and 17 deletions
|
@ -77,14 +77,9 @@ async def login_post(request: Request,
|
|||
return response
|
||||
|
||||
|
||||
@router.get("/logout")
|
||||
@router.post("/logout")
|
||||
@auth_required()
|
||||
async def logout(request: Request, next: str = "/"):
|
||||
""" A GET and POST route for logging out.
|
||||
|
||||
@param request FastAPI request
|
||||
@param next Route to redirect to
|
||||
"""
|
||||
async def logout(request: Request, next: str = Form(default="/")):
|
||||
if request.user.is_authenticated():
|
||||
request.user.logout(request)
|
||||
|
||||
|
@ -95,9 +90,3 @@ async def logout(request: Request, next: str = "/"):
|
|||
response.delete_cookie("AURSID")
|
||||
response.delete_cookie("AURTZ")
|
||||
return response
|
||||
|
||||
|
||||
@router.post("/logout")
|
||||
@auth_required()
|
||||
async def logout_post(request: Request, next: str = "/"):
|
||||
return await logout(request=request, next=next)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue