Support next URL on logout
This commit is contained in:
parent
9d122264e5
commit
33b7d7c5c1
3
main.py
3
main.py
|
@ -109,7 +109,8 @@ def login_page() -> str | werkzeug.Response:
|
||||||
@app.route("/logout")
|
@app.route("/logout")
|
||||||
def logout() -> werkzeug.Response:
|
def logout() -> werkzeug.Response:
|
||||||
"""Handle user logout by clearing the authentication cookie."""
|
"""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)
|
response.set_cookie("auth_token", "", expires=0)
|
||||||
flask.flash("You have been successfully logged out.", "info")
|
flask.flash("You have been successfully logged out.", "info")
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Reference in a new issue