Merge branch 'main' of hectabit.org:arzumify/hectabit-oauth2

This commit is contained in:
Tracker-Friendly 2024-04-02 18:39:12 +01:00
commit 550afa6086
1 changed files with 6 additions and 9 deletions

15
main
View File

@ -373,16 +373,13 @@ async def apideleteauth():
conn = get_db_connection() conn = get_db_connection()
try: try:
conn.execute("DELETE FROM oauth WHERE appId = ? AND creator = ?", (str(appId), str(user["id"]))) conn.execute("DELETE FROM oauth WHERE appId = ? AND creator = ?", (str(appId), int(user["id"])))
conn.commit()
conn.close()
except: except:
return 400 return {}, 400
else: else:
try: return {}, 200
conn.execute("DELETE FROM oauth WHERE appId = ? AND creator = ?", (str(appId), str(user["id"])))
except:
pass
else:
return 200
@app.route("/api/newauth", methods=("GET", "POST")) @app.route("/api/newauth", methods=("GET", "POST"))
async def apicreateauth(): async def apicreateauth():
@ -406,7 +403,7 @@ async def apicreateauth():
except: except:
print("New Oauth added with ID", appId) print("New Oauth added with ID", appId)
else: else:
return 401 return {}, 401
userCookie = get_session(secretKey) userCookie = get_session(secretKey)
user = get_user(userCookie["id"]) user = get_user(userCookie["id"])