Allow _, - and / in party line nicks
This commit is contained in:
parent
1a5b3c7cc2
commit
33783ec07f
|
|
@ -11,6 +11,7 @@ PASS = '34a77e61000b2ba1f56201332ef64d93f9cdc60e63ab48bc255102586ef7e592'
|
||||||
WRONG_LOGIN_BAN_DURATION = 30
|
WRONG_LOGIN_BAN_DURATION = 30
|
||||||
USERS_NAME = "hswroconference:users"
|
USERS_NAME = "hswroconference:users"
|
||||||
BANNED_NAME = "hswroconference:banned"
|
BANNED_NAME = "hswroconference:banned"
|
||||||
|
ALLOWED_NAME_CHARS = ['_', '-', '/'] # this + .isalnum()
|
||||||
|
|
||||||
|
|
||||||
def check_password(password: str) -> bool:
|
def check_password(password: str) -> bool:
|
||||||
|
|
@ -40,7 +41,7 @@ def check_banned(r, userhash):
|
||||||
def check_name(username: str) -> bool:
|
def check_name(username: str) -> bool:
|
||||||
if len(username) >= 16:
|
if len(username) >= 16:
|
||||||
return False
|
return False
|
||||||
return all(map(lambda c: c.isalnum(), username))
|
return all(map(lambda c: c.isalnum() or c in ALLOWED_NAME_CHARS, username))
|
||||||
|
|
||||||
|
|
||||||
def handle_login(msg, r, from_known_sender, known_senders: Iterable):
|
def handle_login(msg, r, from_known_sender, known_senders: Iterable):
|
||||||
|
|
@ -94,7 +95,7 @@ def handle_whoami(msg, _, from_known_sender, known_senders: Iterable):
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
|
|
||||||
def handle_help(msg, _, __, ___):
|
def handle_help(msg, _=None, __=None, ___=None):
|
||||||
msg.reply("""Supported commands:
|
msg.reply("""Supported commands:
|
||||||
/login [NICK] [PASSWORD] - Logs user in. Partyline messages will be sent.
|
/login [NICK] [PASSWORD] - Logs user in. Partyline messages will be sent.
|
||||||
/logout - Logs user out. Partyline messages will stop.
|
/logout - Logs user out. Partyline messages will stop.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue