mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-09 19:27:28 -03:00
Handle exceptions in chat mode's validate_username
This commit is contained in:
parent
fe7bd43f04
commit
3ef52eb59b
1 changed files with 11 additions and 7 deletions
|
@ -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 a new issue