Remove debug print statements and fix db timestamp

This commit is contained in:
Jeremy Zhang 2017-02-09 21:25:37 -08:00
parent 030d492af1
commit 87c0487d50
2 changed files with 3 additions and 4 deletions

View File

@ -27,7 +27,6 @@ def checkUserBanned(guild_id, ip_address=None):
banned = True banned = True
if user_unauthenticated(): if user_unauthenticated():
dbUser = UnauthenticatedBans.query.filter(and_(UnauthenticatedBans.guild_id == guild_id, UnauthenticatedBans.ip_address == ip_address)).all() dbUser = UnauthenticatedBans.query.filter(and_(UnauthenticatedBans.guild_id == guild_id, UnauthenticatedBans.ip_address == ip_address)).all()
print dbUser
if not dbUser: if not dbUser:
banned = False banned = False
else: else:
@ -93,7 +92,6 @@ def fetch():
else: else:
key = None key = None
status = update_user_status(channel_id, session['username'], key) status = update_user_status(channel_id, session['username'], key)
print status['revoked']
if status['banned'] or status['revoked']: if status['banned'] or status['revoked']:
messages = {} messages = {}
else: else:

View File

@ -1,5 +1,6 @@
from titanembeds.database import db from titanembeds.database import db
import datetime import datetime
import time
import random import random
import string import string
@ -20,7 +21,7 @@ class UnauthenticatedUsers(db.Model):
self.discriminator = discriminator self.discriminator = discriminator
self.user_key = "".join(random.choice(string.ascii_letters) for _ in range(0, 32)) self.user_key = "".join(random.choice(string.ascii_letters) for _ in range(0, 32))
self.ip_address = ip_address self.ip_address = ip_address
self.last_timestamp = datetime.datetime.now self.last_timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
self.revoked = False self.revoked = False
def __repr__(self): def __repr__(self):
@ -40,6 +41,6 @@ class UnauthenticatedUsers(db.Model):
return self.revoked return self.revoked
def bumpTimestamp(self): def bumpTimestamp(self):
self.last_timestamp = datetime.datetime.now self.last_timestamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d %H:%M:%S')
db.session.commit() db.session.commit()
return self.last_timestamp return self.last_timestamp