From 0c544d015b211b3a45c0f12d82cd2bc8ade2d47a Mon Sep 17 00:00:00 2001 From: Jeremy Zhang Date: Thu, 11 May 2017 19:02:22 +0000 Subject: [PATCH] Fixed a few authenticated user validation --- webapp/titanembeds/blueprints/api/api.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/webapp/titanembeds/blueprints/api/api.py b/webapp/titanembeds/blueprints/api/api.py index eba0baa..149e05c 100644 --- a/webapp/titanembeds/blueprints/api/api.py +++ b/webapp/titanembeds/blueprints/api/api.py @@ -44,7 +44,10 @@ def checkUserBanned(guild_id, ip_address=None): else: banned = False dbUser = GuildMembers.query.filter(GuildMembers.guild_id == guild_id).filter(GuildMembers.user_id == session["user_id"]).first() - banned = dbUser.banned + if not dbUser: + banned = False + else: + banned = dbUser.banned return banned def update_user_status(guild_id, username, user_key=None): @@ -94,7 +97,7 @@ def check_user_in_guild(guild_id): return guild_id in session['user_keys'] else: dbUser = db.session.query(AuthenticatedUsers).filter(and_(AuthenticatedUsers.guild_id == guild_id, AuthenticatedUsers.client_id == session['user_id'])).first() - return not checkUserRevoke(guild_id) and dbUser is not None + return dbUser is not None and not checkUserRevoke(guild_id) def format_post_content(guild_id, message): illegal_post = False