Check illegal username

This commit is contained in:
Jeremy Zhang
2017-04-08 14:53:58 -07:00
parent 9801aafb58
commit 0509b44078
2 changed files with 25 additions and 14 deletions

View File

@ -274,8 +274,11 @@ def create_unauthenticated_user():
username = request.form['username']
guild_id = request.form['guild_id']
ip_address = get_client_ipaddr()
username = username.strip()
if len(username) < 2 or len(username) > 32:
abort(406)
if not all(x.isalpha() or x.isspace() or "-" == x or "_" == x for x in username):
abort(406)
if not check_guild_existance(guild_id):
abort(404)
if not guild_query_unauth_users_bool(guild_id):