Fix for WebSocket failing when the page is refreshed

This commit is contained in:
GulliblePsychologist 2020-01-14 21:07:23 +00:00
parent edff348d87
commit 312656c368
3 changed files with 31 additions and 6 deletions

View file

@ -61,3 +61,10 @@ class SharedLoginMiddleware(object):
login(request, account)
except AttributeError:
logger.log_trace()
if csession.get("webclient_authenticated_uid", None):
# set a nonce to prevent the webclient from erasing the webclient_authenticated_uid value
csession["webclient_authenticated_nonce"] = csession.get("webclient_authenticated_nonce", 0) + 1
# wrap around to prevent integer overflows
if csession["webclient_authenticated_nonce"] > 32:
csession["webclient_authenticated_nonce"] = 0