From 1498587437745bbece481a16324ed045ef30eda8 Mon Sep 17 00:00:00 2001 From: Michel Roux Date: Sun, 18 Sep 2022 21:15:03 +0000 Subject: [PATCH] Add redirection if not logged --- divent/bot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/divent/bot.py b/divent/bot.py index c6f9de6..6728212 100644 --- a/divent/bot.py +++ b/divent/bot.py @@ -140,6 +140,8 @@ def login_required(fn): async def wrapper(*args, **kwargs): if session.get("oauth2_token"): return await fn(*args, **kwargs) + + session["redirect_url"] = request.path return redirect(url_for(".login")) return wrapper @@ -171,7 +173,7 @@ async def callback(): authorization_response=request.url, ) token_updater(token) - return redirect(url_for(".guilds")) + return redirect(session.pop("redirect_url", url_for(".guilds"))) @app.route("/guilds")