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):
username = self.remove_unallowed_characters(username.strip())
return (
username
and username not in self.connected_users
and len(username) < 128
)
try:
username = self.remove_unallowed_characters(username.strip())
return (
username
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):
"""
@ -160,7 +164,7 @@ class ChatModeWeb:
broadcast=True,
)
else:
raise ConnectionRefusedError('You are active from another session!')
raise ConnectionRefusedError('Invalid session')
@self.web.socketio.on("text", namespace="/chat")
def text(message):