Added missing conn.close
This commit is contained in:
parent
764bd36f86
commit
8526134305
7
main
7
main
|
@ -75,7 +75,6 @@ def check_username_taken(username):
|
||||||
|
|
||||||
async def oauth2_token_refresh(openid, appId):
|
async def oauth2_token_refresh(openid, appId):
|
||||||
while True:
|
while True:
|
||||||
print(openid, appId)
|
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
|
|
||||||
# Fetch required data in a single query
|
# Fetch required data in a single query
|
||||||
|
@ -232,10 +231,13 @@ async def apiopeniduserinfo():
|
||||||
userid = int(conn.execute("SELECT creator FROM logins WHERE code = ?", (str(access_token),)).fetchone()[0])
|
userid = int(conn.execute("SELECT creator FROM logins WHERE code = ?", (str(access_token),)).fetchone()[0])
|
||||||
user = get_user(userid)
|
user = get_user(userid)
|
||||||
|
|
||||||
|
conn.close()
|
||||||
|
|
||||||
datatemplate = {
|
datatemplate = {
|
||||||
"sub": user["username"],
|
"sub": user["username"],
|
||||||
"name": user["username"]
|
"name": user["username"]
|
||||||
}
|
}
|
||||||
|
|
||||||
return datatemplate
|
return datatemplate
|
||||||
|
|
||||||
@app.route("/api/auth", methods=("GET", "POST"))
|
@app.route("/api/auth", methods=("GET", "POST"))
|
||||||
|
@ -250,7 +252,6 @@ async def apiauthenticate():
|
||||||
conn = get_db_connection()
|
conn = get_db_connection()
|
||||||
secretkey = str(secrets.token_hex(512))
|
secretkey = str(secrets.token_hex(512))
|
||||||
|
|
||||||
print(appId)
|
|
||||||
appidcheck = str(conn.execute("SELECT appId FROM oauth WHERE appId = ?", (str(appId),)).fetchone()[0])
|
appidcheck = str(conn.execute("SELECT appId FROM oauth WHERE appId = ?", (str(appId),)).fetchone()[0])
|
||||||
if not str(appidcheck) == str(appId):
|
if not str(appidcheck) == str(appId):
|
||||||
return {}, 401
|
return {}, 401
|
||||||
|
@ -313,6 +314,8 @@ async def apitokenexchange():
|
||||||
# Fetch openid and code in a single query
|
# Fetch openid and code in a single query
|
||||||
login_data = conn.execute("SELECT openid, code FROM logins WHERE appId = ? AND secret = ?", (str(appId), str(code))).fetchone()
|
login_data = conn.execute("SELECT openid, code FROM logins WHERE appId = ? AND secret = ?", (str(appId), str(code))).fetchone()
|
||||||
|
|
||||||
|
conn.close()
|
||||||
|
|
||||||
if login_data:
|
if login_data:
|
||||||
access_token = {
|
access_token = {
|
||||||
"access_token": str(login_data["code"]),
|
"access_token": str(login_data["code"]),
|
||||||
|
|
Reference in New Issue