Merge pull request #16 from kroketio/session_cookie_name_fix
Session cookie name fix
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
### 2.1.0
|
||||||
|
|
||||||
|
- `session_cookie_name` fix
|
||||||
|
|
||||||
### 2.0.0
|
### 2.0.0
|
||||||
|
|
||||||
- Move from aioredis to redis
|
- Move from aioredis to redis
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
:license: BSD, see LICENSE for more details.
|
:license: BSD, see LICENSE for more details.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__version__ = '2.0.0'
|
__version__ = '2.1.0'
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ class SessionInterface(QuartSessionInterface):
|
|||||||
app: Quart,
|
app: Quart,
|
||||||
request: BaseRequestWebsocket
|
request: BaseRequestWebsocket
|
||||||
) -> Optional[SecureCookieSession]:
|
) -> 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:
|
if self._config['SESSION_REVERSE_PROXY'] is True:
|
||||||
# and no, you cannot define your own incoming
|
# and no, you cannot define your own incoming
|
||||||
# header, stick to standards :-)
|
# header, stick to standards :-)
|
||||||
@@ -163,13 +164,14 @@ class SessionInterface(QuartSessionInterface):
|
|||||||
isinstance(response.response, FileBody):
|
isinstance(response.response, FileBody):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
cname = app.config.get('SESSION_COOKIE_NAME', 'session')
|
||||||
session_key = self.key_prefix + session.sid
|
session_key = self.key_prefix + session.sid
|
||||||
domain = self.get_cookie_domain(app)
|
domain = self.get_cookie_domain(app)
|
||||||
path = self.get_cookie_path(app)
|
path = self.get_cookie_path(app)
|
||||||
if not session:
|
if not session:
|
||||||
if session.modified:
|
if session.modified:
|
||||||
await self.delete(key=session_key, app=app)
|
await self.delete(key=session_key, app=app)
|
||||||
response.delete_cookie(app.session_cookie_name,
|
response.delete_cookie(cname,
|
||||||
domain=domain, path=path)
|
domain=domain, path=path)
|
||||||
return
|
return
|
||||||
httponly = self.get_cookie_httponly(app)
|
httponly = self.get_cookie_httponly(app)
|
||||||
@@ -187,7 +189,7 @@ class SessionInterface(QuartSessionInterface):
|
|||||||
session_id = self._get_signer(app).sign(want_bytes(session.sid))
|
session_id = self._get_signer(app).sign(want_bytes(session.sid))
|
||||||
else:
|
else:
|
||||||
session_id = session.sid
|
session_id = session.sid
|
||||||
response.set_cookie(app.session_cookie_name, session_id,
|
response.set_cookie(cname, session_id,
|
||||||
expires=expires, httponly=httponly,
|
expires=expires, httponly=httponly,
|
||||||
domain=domain, path=path, secure=secure, samesite=samesite)
|
domain=domain, path=path, secure=secure, samesite=samesite)
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ INSTALL_REQUIRES = [
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='Quart-Session',
|
name='Quart-Session',
|
||||||
version='2.0.0',
|
version='2.1.0',
|
||||||
url='https://github.com/kroketio/quart-session',
|
url='https://github.com/kroketio/quart-session',
|
||||||
license='BSD',
|
license='BSD',
|
||||||
author='Kroket Ltd.',
|
author='Kroket Ltd.',
|
||||||
|
|||||||
Reference in New Issue
Block a user