Skip to content

Commit

Permalink
fix empty session
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Aug 21, 2024
1 parent 0eff770 commit 98f1cb8
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions server/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ async def authenticate_request(
) -> AuthenticationResult:
if not connection.session or connection.scope["session"] is Empty:
# the assignment of 'Empty' forces the session middleware to clear session data.
connection.scope["session"] = Empty
return AuthenticationResult(user=None, auth=None)

user = await retrieve_user_from_session(connection.session, connection)
Expand Down Expand Up @@ -131,11 +130,7 @@ async def callback(code: str, request: Request) -> Redirect:
user["nickname"],
)

# litestar type this as dict[str, Any], but it maybe Empty
if isinstance(request.session, dict):
back_to = request.session.get("backTo", "/")
else:
back_to = "/"
back_to = request.session.get("backTo", "/")

request.set_session(
{
Expand Down

0 comments on commit 98f1cb8

Please sign in to comment.