diff --git a/app/auth/views/logout.py b/app/auth/views/logout.py index cad96694..98b63b38 100644 --- a/app/auth/views/logout.py +++ b/app/auth/views/logout.py @@ -2,6 +2,7 @@ from flask import redirect, url_for, flash, make_response from flask_login import logout_user from app.auth.base import auth_bp +from app.config import SESSION_COOKIE_NAME @auth_bp.route("/logout") @@ -9,7 +10,7 @@ def logout(): logout_user() flash("You are logged out", "success") response = make_response(redirect(url_for("auth.login"))) - response.delete_cookie("slapp") + response.delete_cookie(SESSION_COOKIE_NAME) response.delete_cookie("mfa") response.delete_cookie("dark-mode") diff --git a/app/config.py b/app/config.py index 7177dbce..2ceac359 100644 --- a/app/config.py +++ b/app/config.py @@ -144,6 +144,7 @@ DB_URI = os.environ["DB_URI"] # Flask secret FLASK_SECRET = os.environ["FLASK_SECRET"] +SESSION_COOKIE_NAME = "slapp" MAILBOX_SECRET = FLASK_SECRET + "mailbox" CUSTOM_ALIAS_SECRET = FLASK_SECRET + "custom_alias" diff --git a/server.py b/server.py index ba05acd5..3aea0b72 100644 --- a/server.py +++ b/server.py @@ -39,6 +39,7 @@ from app.config import ( FLASK_PROFILER_PASSWORD, SENTRY_FRONT_END_DSN, FIRST_ALIAS_DOMAIN, + SESSION_COOKIE_NAME, ) from app.dashboard.base import dashboard_bp from app.developer.base import developer_bp @@ -100,7 +101,7 @@ def create_app() -> Flask: app.config["TEMPLATES_AUTO_RELOAD"] = True # to avoid conflict with other cookie - app.config["SESSION_COOKIE_NAME"] = "slapp" + app.config["SESSION_COOKIE_NAME"] = SESSION_COOKIE_NAME if URL.startswith("https"): app.config["SESSION_COOKIE_SECURE"] = True app.config["SESSION_COOKIE_SAMESITE"] = "Lax"