Oughta work

It oughta work, this is a different way of pulling the code.
pull/6/head
Hailey Clark 6 years ago
parent 0f85326a16
commit 517266b805
  1. 5
      app-ajax.py
  2. 11
      appdb.py

@ -40,7 +40,10 @@ def index():
if indbRes: if indbRes:
pprint.pprint(indbRes) pprint.pprint(indbRes)
refreshtoken = google_auth.getRefreshToken() refreshtoken = google_auth.getRefreshToken()
userid = appdb.getUserIdFromRT(refreshtoken) if not refreshtoken:
return "Error with your refresh token"
userid = appdb.getUserIDfromGoogleID(user_info['id'])
if not userid: if not userid:
return 'You are not currently logged in.' return 'You are not currently logged in.'

@ -72,6 +72,17 @@ def getUserIdFromRT(refreshtoken):
return False return False
return data[0] return data[0]
def getUserIDfromGoogleID(google_id):
#This pulls an UserID from a Google ID
db = pymysql.connect(host=sqlhost, user=sqluser, passwd=sqlpass, db=sqldb)
cur = db.cursor()
cur.execute("SELECT id FROM account WHERE google_id=%s",(google_id))
data = cur.fetchone()
db.close()
if not data:
return False
return data[0]
def getAccountbyDID(did): def getAccountbyDID(did):
#This function pulls the account id for the DID in the query. #This function pulls the account id for the DID in the query.
db = pymysql.connect(host=sqlhost, user=sqluser, passwd=sqlpass, db=sqldb) db = pymysql.connect(host=sqlhost, user=sqluser, passwd=sqlpass, db=sqldb)

Loading…
Cancel
Save