From 5c04dffb0d371667fd6f3e357d96ba6c866df645 Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Wed, 16 Jan 2019 18:00:36 +0000 Subject: [PATCH] Limit usernames to 25 characters --- webapp/titanembeds/blueprints/api/api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/webapp/titanembeds/blueprints/api/api.py b/webapp/titanembeds/blueprints/api/api.py index ceb81cb..917277d 100644 --- a/webapp/titanembeds/blueprints/api/api.py +++ b/webapp/titanembeds/blueprints/api/api.py @@ -311,7 +311,10 @@ def post(): # content = "(Titan Dev) " + content if webhook: if (session['unauthenticated']): - username = session["username"] + "#" + str(session["user_id"]) + username = session["username"] + if len(username) > 25: + username = username[:25] + username = username + "#" + str(session["user_id"]) avatar = url_for('static', filename='img/titanembeds_square.png', _external=True) dbguild = db.session.query(Guilds).filter(Guilds.guild_id == guild_id).first() if dbguild: @@ -326,6 +329,8 @@ def post(): # if content.startswith("(Titan Dev) "): # content = content[12:] # username = "(Titan Dev) " + username + if len(username) > 25: + username = username[:25] username = username + "#" + str(session['discriminator']) avatar = session['avatar'] message = discord_api.execute_webhook(webhook.get("id"), webhook.get("token"), username, avatar, content, file)