Quick fix to prevent really long discriminators for unauthenticated users

This commit is contained in:
Jeremy Zhang 2017-04-15 07:54:57 +00:00
parent 112bdcf2d0
commit acbb7ff3a9

View File

@ -317,7 +317,7 @@ def create_unauthenticated_user():
abort(401) abort(401)
if not checkUserBanned(guild_id, ip_address): if not checkUserBanned(guild_id, ip_address):
session['username'] = username session['username'] = username
if 'user_id' not in session: if 'user_id' not in session or len(str(session["user_id"])) > 4:
session['user_id'] = random.randint(0,9999) session['user_id'] = random.randint(0,9999)
user = UnauthenticatedUsers(guild_id, username, session['user_id'], ip_address) user = UnauthenticatedUsers(guild_id, username, session['user_id'], ip_address)
db.session.add(user) db.session.add(user)