Support next URL on logout

This commit is contained in:
Edward Betts 2024-01-22 12:41:38 +00:00
parent 9d122264e5
commit 33b7d7c5c1

View file

@ -109,7 +109,8 @@ def login_page() -> str | werkzeug.Response:
@app.route("/logout")
def logout() -> werkzeug.Response:
"""Handle user logout by clearing the authentication cookie."""
response = flask.redirect(flask.url_for("login_page"))
after_login = flask.request.args.get("next")
response = flask.redirect(flask.url_for("login_page", next=after_login))
response.set_cookie("auth_token", "", expires=0)
flask.flash("You have been successfully logged out.", "info")
return response