Defined conn earlier
This commit is contained in:
parent
e27cf47083
commit
313d81742f
2
main
2
main
|
@ -272,6 +272,7 @@ async def apicreateauth():
|
||||||
appId = data["appId"]
|
appId = data["appId"]
|
||||||
secretKey = data["secretKey"]
|
secretKey = data["secretKey"]
|
||||||
secret = str(secrets.token_hex(512))
|
secret = str(secrets.token_hex(512))
|
||||||
|
conn = get_db_connection()
|
||||||
while True:
|
while True:
|
||||||
if not secret == str(conn.execute("SELECT secret FROM oauth WHERE secret = ?", (str(secret)))).fetchone():
|
if not secret == str(conn.execute("SELECT secret FROM oauth WHERE secret = ?", (str(secret)))).fetchone():
|
||||||
break
|
break
|
||||||
|
@ -285,7 +286,6 @@ async def apicreateauth():
|
||||||
userCookie = get_session(secretKey)
|
userCookie = get_session(secretKey)
|
||||||
user = get_user(userCookie["id"])
|
user = get_user(userCookie["id"])
|
||||||
|
|
||||||
conn = get_db_connection()
|
|
||||||
conn.execute("INSERT INTO keys (appId, creator, secret) VALUES (?, ?, ?)",
|
conn.execute("INSERT INTO keys (appId, creator, secret) VALUES (?, ?, ?)",
|
||||||
(str(appId),int(user["id"]),str(secret)))
|
(str(appId),int(user["id"]),str(secret)))
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
Reference in New Issue