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
|
||||
|
||||
- Move from aioredis to redis
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
:license: BSD, see LICENSE for more details.
|
||||
"""
|
||||
|
||||
__version__ = '2.0.0'
|
||||
__version__ = '2.1.0'
|
||||
|
||||
import os
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user