mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Handle exceptions in chat mode's validate_username
This commit is contained in:
parent
fe7bd43f04
commit
3ef52eb59b
@ -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):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user