Remove API key From Console
parent
d75c18e8db
commit
e2f12cc6c7
10
main.py
10
main.py
|
|
@ -160,7 +160,7 @@ async def set_user(get: CL.CL_SET_HOST_USER,api_key: APIKey = Depends(auth.get_a
|
|||
|
||||
@app.post("/user/get")
|
||||
async def get_user(get: CL.CL_GET_HOST_USER,api_key: APIKey = Depends(auth.get_api_key)):
|
||||
result = database(f"SELECT id FROM `{get.dbname}`.user WHERE user = '{get.user}'","","")
|
||||
result = database(f"SELECT id FROM `{get.dbname}`.`Active-Directory-User` WHERE SamAccountName = '{get.user} ORDER BY ID DESC LIMIT 1'","","")
|
||||
if not result:
|
||||
return False
|
||||
else:
|
||||
|
|
@ -168,13 +168,7 @@ async def get_user(get: CL.CL_GET_HOST_USER,api_key: APIKey = Depends(auth.get_a
|
|||
|
||||
@app.post("/user/set/lastlogon")
|
||||
async def set_lastlogon_user(get: CL.CL_SET_LASTLOGON_USER,api_key: APIKey = Depends(auth.get_api_key)):
|
||||
database(f"INSERT INTO `{get.dbname}`.lastlogon (lastlogon) VALUES ('{get.lastlogon}')","","")
|
||||
lastlogonid = database(f"SELECT id FROM `{get.dbname}`.lastlogon WHERE lastlogon = '{get.lastlogon}'","","")
|
||||
result = database(f"INSERT INTO `{get.dbname}`.lastlogon_to_user (userID,lastlogonID) VALUES ('{get.userID}','{lastlogonid[0][0]}')", "", "")
|
||||
if not result:
|
||||
return False
|
||||
else:
|
||||
return result[0][0]
|
||||
database(f"INSERT INTO `{get.dbname}`.LastLogonToADUser (aduserid,lastlogon) VALUES ('{get.userID}','{get.lastlogon}')", "", "")
|
||||
|
||||
|
||||
@app.post("/info/getclient")
|
||||
|
|
|
|||
Loading…
Reference in New Issue