first shot at proper login.

This commit is contained in:
gluap 2022-03-10 20:42:46 +01:00 committed by Paul Bienkowski
parent 0c43e49bb4
commit e09c257995

View file

@ -148,10 +148,12 @@ async def login_redirect(req):
@api.route("/logout") @api.route("/logout")
async def login(req): async def logout(req):
session = req.ctx.session session = req.ctx.session
if "user_id" in session: if "user_id" in session:
del session["user_id"] del session["user_id"]
next_url = req.ctx.get_single_arg("next", default=None) or "/" auth_req = client.construct_EndSessionRequest(state=session["state"])
return redirect(next_url) logout_url = auth_req.request(client.end_session_endpoint)
return redirect(logout_url+f"&redirect_uri={req.ctx.api_url}/logout")