Skip to content

Commit

Permalink
redirect to home page with error message if state is invalid and some…
Browse files Browse the repository at this point in the history
… admin ui updates (#54)

* redirect to home page with error message if state is invalid

* ui updates
  • Loading branch information
amalshaji committed Apr 30, 2024
1 parent 23dbede commit 94011c2
Show file tree
Hide file tree
Showing 7 changed files with 363 additions and 11 deletions.
2 changes: 1 addition & 1 deletion admin/src/portr_admin/apis/v1/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async def github_login(request: Request):
async def github_callback(request: Request, code: str, state: str):
existing_state = request.cookies.get("oauth_state")
if state != existing_state:
return Response(status_code=400, content="Invalid state")
return RedirectResponse(url="/?code=invalid-state")

try:
user = await user_service.get_or_create_user_from_github(code)
Expand Down
2 changes: 2 additions & 0 deletions admin/src/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"check": "svelte-check --tsconfig ./tsconfig.json"
},
"devDependencies": {
"@dicebear/collection": "^8.0.1",
"@dicebear/core": "^8.0.1",
"@sveltejs/vite-plugin-svelte": "^2.5.3",
"@tsconfig/svelte": "^5.0.4",
"autoprefixer": "^10.4.19",
Expand Down
341 changes: 341 additions & 0 deletions admin/src/web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 94011c2

Please sign in to comment.