Max username length is 16 now

feature-admin-split
Darksider3 5 years ago
parent cab4cd25a2
commit c40ef4d40a

@ -82,6 +82,9 @@ def check_username(value):
if len(value) < 3: if len(value) < 3:
VALID_USER=False VALID_USER=False
return False return False
if len(value) > 16:
VALID_USER=False
return False
try: try:
from pwd import getpwnam from pwd import getpwnam
getpwnam(value) getpwnam(value)
@ -125,7 +128,8 @@ def main():
username = input("Welcome to the ~.fun user application form!\n\nWhat is your desired username? [a-z0-9] allowed:\n") username = input("Welcome to the ~.fun user application form!\n\nWhat is your desired username? [a-z0-9] allowed:\n")
while (not re.match("[a-z]+[a-z0-9]", username)) or (not check_username(username)): while (not re.match("[a-z]+[a-z0-9]", username)) or (not check_username(username)):
username = input("Invalid Username, maybe it exists already?\nValid characters are only a-z and 0-9." username = input("Invalid Username, maybe it exists already?\nValid characters are only a-z and 0-9."
"\nMake sure your username starts with a character and not a number." "\nMake sure your username starts with a character and not a number"
" and is not larger than 16 characters."
"\nWhat is your desired username? [a-z0-9] allowed:\n") "\nWhat is your desired username? [a-z0-9] allowed:\n")
fullname = input("\nPlease enter your full name:\n") fullname = input("\nPlease enter your full name:\n")

Loading…
Cancel
Save