Fixed weird-ahh conn connection and oauth table

This commit is contained in:
Tracker-Friendly 2024-03-28 17:51:29 +00:00
parent 313d81742f
commit f3ae325532
2 changed files with 8 additions and 3 deletions

4
main
View File

@ -224,8 +224,8 @@ async def apiauthenticate():
if not str(clientidcheck) == str(appId): if not str(clientidcheck) == str(appId):
return {}, 401 return {}, 401
conn.execute("INSERT INTO logins (appId, authed, secret, code, nextcode, creator, openid) VALUES (?, ?, ?, ?, ?, ?, ?)", conn.execute("INSERT INTO logins (appId, secret, code, nextcode, creator, openid) VALUES (?, ?, ?, ?, ?, ?)",
(str(appId), int(int(time.time()) + 3600), int(0), str(secretkey), str(secrets.token_hex(512)), str(secrets.token_hex(512)), int(user["id"]), str(secrets.token_hex(512)))) (str(appId), str(secretkey), str(secrets.token_hex(512)), str(secrets.token_hex(512)), int(user["id"]), str(secrets.token_hex(512))))
conn.commit() conn.commit()
conn.close() conn.close()

View File

@ -25,10 +25,15 @@ CREATE TABLE sessions (
CREATE TABLE logins ( CREATE TABLE logins (
appId TEXT NOT NULL, appId TEXT NOT NULL,
authed INTEGER NOT NULL,
secret TEXT NOT NULL, secret TEXT NOT NULL,
code TEXT NOT NULL, code TEXT NOT NULL,
nextcode TEXT NOT NULL, nextcode TEXT NOT NULL,
creator INTEGER NOT NULL, creator INTEGER NOT NULL,
openid TEXT NOT NULL openid TEXT NOT NULL
) )
CREATE TABLE oauth (
appId TEXT NOT NULL,
secret TEXT NOT NULL,
creator INTEGER NOT NULL
)