Merge branch 'main' of github.com:onionshare/onionshare-ghsa-r78w-rpvr-g57q into release-2.6.2

This commit is contained in:
Saptak S 2024-03-15 12:36:18 +05:30
commit c0e7a4a0f4
No known key found for this signature in database
GPG key ID: 7B7F1772C0C6FCBF

View file

@ -76,12 +76,16 @@ class ChatModeWeb:
) )
def validate_username(self, username): def validate_username(self, username):
username = self.remove_unallowed_characters(username.strip()) try:
return ( username = self.remove_unallowed_characters(username.strip())
username return (
and username not in self.connected_users username
and len(username) < 128 and username not in self.connected_users
) and len(username) < 128
)
except Exception as e:
self.common.log("ChatModeWeb", "validate_username", e)
return False
def define_routes(self): def define_routes(self):
""" """
@ -160,7 +164,7 @@ class ChatModeWeb:
broadcast=True, broadcast=True,
) )
else: else:
raise ConnectionRefusedError('You are active from another session!') raise ConnectionRefusedError('Invalid session')
@self.web.socketio.on("text", namespace="/chat") @self.web.socketio.on("text", namespace="/chat")
def text(message): def text(message):