Skip to content

Commit

Permalink
implemented logout functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
khoing0810 committed Aug 18, 2023
1 parent 7610272 commit 1de289c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
13 changes: 1 addition & 12 deletions app/routers/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,7 @@ async def logout(request: Request, response: Response):
I usually open a new tab/window to reset basic auth. We likely
need a logout button to be handled somehow in javascript.
"""
response.delete_cookie("basic")
response.delete_cookie("bearer")
response.delete_cookie("access_token")
data = helpers.get_page("index.md")
return templates.TemplateResponse(
"index.html",
{
"request": request,
"data": data,
},
)

raise HTTPException(status_code=401, detail="Logged out successfully", headers={'WWW-Authenticate': 'Basic'})

# View job detail (and log)
@auth_views_router.get(
Expand Down
3 changes: 3 additions & 0 deletions templates/include/topnav.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<li class="nav-item {{'active' if active_page == 'jobs' }}">
<a class="nav-link" href="/jobs">Jobs</a>
</li>
<li>
<a class="nav-link" href="/logout">Logout</a>
</li>
<li class="nav-item {{'active' if active_page == 'api' }}">
<a class="nav-link" href="/docs">API</a>
</li>
Expand Down

0 comments on commit 1de289c

Please sign in to comment.