diff --git a/CHANGELOG.md b/CHANGELOG.md index 073aaea..c4d6f3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 2.1.0 + +- `session_cookie_name` fix + ### 2.0.0 - Move from aioredis to redis diff --git a/quart_session/__init__.py b/quart_session/__init__.py index 982e308..aba5cc2 100644 --- a/quart_session/__init__.py +++ b/quart_session/__init__.py @@ -10,7 +10,7 @@ :license: BSD, see LICENSE for more details. """ -__version__ = '2.0.0' +__version__ = '2.1.0' import os diff --git a/quart_session/sessions.py b/quart_session/sessions.py index 7cb5823..925c6da 100644 --- a/quart_session/sessions.py +++ b/quart_session/sessions.py @@ -92,7 +92,8 @@ class SessionInterface(QuartSessionInterface): app: Quart, request: BaseRequestWebsocket ) -> Optional[SecureCookieSession]: - sid = request.cookies.get(app.session_cookie_name) + cname = app.config.get('SESSION_COOKIE_NAME', 'session') + sid = request.cookies.get(cname) if self._config['SESSION_REVERSE_PROXY'] is True: # and no, you cannot define your own incoming # header, stick to standards :-) @@ -163,13 +164,14 @@ class SessionInterface(QuartSessionInterface): isinstance(response.response, FileBody): return + cname = app.config.get('SESSION_COOKIE_NAME', 'session') session_key = self.key_prefix + session.sid domain = self.get_cookie_domain(app) path = self.get_cookie_path(app) if not session: if session.modified: await self.delete(key=session_key, app=app) - response.delete_cookie(app.session_cookie_name, + response.delete_cookie(cname, domain=domain, path=path) return httponly = self.get_cookie_httponly(app) @@ -187,7 +189,7 @@ class SessionInterface(QuartSessionInterface): session_id = self._get_signer(app).sign(want_bytes(session.sid)) else: session_id = session.sid - response.set_cookie(app.session_cookie_name, session_id, + response.set_cookie(cname, session_id, expires=expires, httponly=httponly, domain=domain, path=path, secure=secure, samesite=samesite) diff --git a/setup.py b/setup.py index c9b9572..279fbb3 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ INSTALL_REQUIRES = [ setup( name='Quart-Session', - version='2.0.0', + version='2.1.0', url='https://github.com/kroketio/quart-session', license='BSD', author='Kroket Ltd.',