api: respect ?next= url parmeter on login
This commit is contained in:
parent
3b3291b6d3
commit
5e7569395b
1 changed files with 8 additions and 5 deletions
|
|
@ -147,16 +147,19 @@ async def login_callback(req: Request, resp: Response, oidc_client: deps.OpenidC
|
|||
deps.persist_auth_state(
|
||||
oidc_client, resp, auth_result, auth_start_time, req.cookies["auth_nonce"]
|
||||
)
|
||||
|
||||
# redirect the user to the page they wanted to visit
|
||||
# TODO: respect "auth_next" cookie to redirect the user to a specific url
|
||||
logger.debug("successfully authenticated user")
|
||||
return str(req.url_for("get-user-info"))
|
||||
|
||||
# respect originally requested ?next= url and reset the storage
|
||||
resp.set_cookie("auth_next", "", max_age=0)
|
||||
if "auth_next" in req.cookies:
|
||||
return req.cookies["auth_next"]
|
||||
else:
|
||||
return "/"
|
||||
else:
|
||||
logger.debug(
|
||||
"could not authenticate user because of OIDC error; redirecting to error page with error messages intact"
|
||||
)
|
||||
return f"/auth/login-error?{req.query_params}"
|
||||
return f"/login-error?{req.query_params}"
|
||||
|
||||
|
||||
@app.get(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue