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")