Merge pull request #2563 from GulliblePsychologist/issue-2562

Webclient authentication sometimes fails (fixes #2562)
This commit is contained in:
Griatch 2021-10-14 21:22:41 +02:00 committed by GitHub
commit 8d5b48d4cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -49,7 +49,7 @@ class WebSocketClient(WebSocketServerProtocol, _BASE_SESSION_CLASS):
# nonce value, used to prevent the webclient from erasing the
# webclient_authenticated_uid value of csession on disconnect
nonce = None
nonce = 0
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
@ -143,7 +143,7 @@ class WebSocketClient(WebSocketServerProtocol, _BASE_SESSION_CLASS):
# set *before* this disconnect (disconnect called after a new client
# connects, which occurs in some 'fast' browsers like Google Chrome
# and Mobile Safari)
if csession.get("webclient_authenticated_nonce", None) == self.nonce:
if csession.get("webclient_authenticated_nonce", 0) == self.nonce:
csession["webclient_authenticated_uid"] = None
csession["webclient_authenticated_nonce"] = 0
csession.save()