Skip to content

Commit

Permalink
fix: login redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Sep 5, 2024
1 parent 2ed8f93 commit b88e394
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions server/review.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ async def __accept_patch(
request: AuthorizedRequest,
) -> Redirect:
if not request.auth.is_access_token_fresh():
request.set_session({session_key_back_to: request.url.path})
request.set_session({session_key_back_to: f"/subject/{patch.id}"})
return Redirect("/login")

subject = _strip_none(
Expand Down Expand Up @@ -254,7 +254,7 @@ async def review_episode_patch(

if data.react == React.Accept:
patch = EpisodePatch.from_dict(p)
return await self.__accept_episode_patch(patch, conn, request.auth)
return await self.__accept_episode_patch(patch, conn, request, request.auth)

raise NotAuthorizedException("暂不支持")

Expand All @@ -279,9 +279,14 @@ async def __reject_episode_patch(
return Redirect("/?type=episode")

async def __accept_episode_patch(
self, patch: EpisodePatch, conn: PoolConnectionProxy[Record], auth: User
self,
patch: EpisodePatch,
conn: PoolConnectionProxy[Record],
request: AuthorizedRequest,
auth: User,
) -> Redirect:
if not auth.is_access_token_fresh():
request.set_session({session_key_back_to: f"/episode/{patch.id}"})
return Redirect("/login")

episode = _strip_none(
Expand Down

0 comments on commit b88e394

Please sign in to comment.