diff --git a/flask_mongoengine/sessions.py b/flask_mongoengine/sessions.py index 756359ee..2a8df49d 100644 --- a/flask_mongoengine/sessions.py +++ b/flask_mongoengine/sessions.py @@ -56,7 +56,7 @@ def get_expiration_time(self, app, session) -> timedelta: return timedelta(**app.config.get("SESSION_TTL", {"days": 1})) def open_session(self, app, request): - sid = request.cookies.get(app.session_cookie_name) + sid = request.cookies.get(app.config["SESSION_COOKIE_NAME"]) if sid: stored_session = self.cls.objects(sid=sid).first() @@ -81,7 +81,7 @@ def save_session(self, app, session, response): # If the session is empty, return without setting the cookie. if not session: if session.modified: - response.delete_cookie(app.session_cookie_name, domain=domain) + response.delete_cookie(app.config["SESSION_COOKIE_NAME"], domain=domain) return expiration = datetime.utcnow().replace(tzinfo=utc) + self.get_expiration_time( @@ -92,7 +92,7 @@ def save_session(self, app, session, response): self.cls(sid=session.sid, data=session, expiration=expiration).save() response.set_cookie( - app.session_cookie_name, + app.config["SESSION_COOKIE_NAME"], session.sid, expires=expiration, httponly=httponly,