Handle exceptions in chat mode's validate_username

This commit is contained in:
Micah Lee 2024-03-07 19:51:32 -08:00
parent fe7bd43f04
commit 3ef52eb59b
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -48,13 +48,17 @@ class ChatModeWeb:
self.define_routes()
def validate_username(self, username):
username = username.strip()
return (
username
and username.isascii()
and username not in self.connected_users
and len(username) < 128
)
try:
username = username.strip()
return (
username
and username.isascii()
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):
"""