misc: clean more session attributes on session change (#14216) #775

Merged
fpeters merged 1 commits from wip/14216-clean-session-attributes-on-user-change into main 2023-10-27 08:33:19 +02:00
2 changed files with 8 additions and 0 deletions

View File

@ -164,6 +164,8 @@ class Session(QommonSession, CaptchaSession, StorableObject):
def set_user(self, user_id): # noqa pylint: disable=arguments-renamed
self.id = None # force a new session id to be assigned
self.extra_user_variables = None
self.has_uploads = False
self.jsonp_display_values = None
QuixoteSession.set_user(self, user_id)
if user_id is None:
return

View File

@ -115,6 +115,12 @@ class BasicSession(Session):
del session.visiting_objects[object_key]
session.store()
def set_user(self, user_id):
super().set_user(user_id)
if self.user:
self.anonymous_formdata_keys = None
self.magictokens = None
sessions.BasicSession = BasicSession
StorageSessionManager = sessions.StorageSessionManager