bugfix
This commit is contained in:
parent
01e9c963a0
commit
238e31909d
16
dapi/dapi.py
16
dapi/dapi.py
@ -33,23 +33,23 @@ async def get_secretkey(sor, appid):
|
|||||||
async def get_apikey_user(sor, apikey):
|
async def get_apikey_user(sor, apikey):
|
||||||
f = get_serverenv('password_encode')
|
f = get_serverenv('password_encode')
|
||||||
apikey = f(apikey)
|
apikey = f(apikey)
|
||||||
sql = """select u.* from downapikey a, users u
|
sql = """select u.* from downapikey a, users u
|
||||||
where a.userid = b.id
|
where a.userid = b.id
|
||||||
and apikey=${apikey}$
|
and apikey=${apikey}$
|
||||||
and expired_date > ${today}$"""
|
and expired_date > ${today}$"""
|
||||||
|
|
||||||
recs = await sor.sqlExe(sql, {"apikey":apikey, 'today': curDateString()})
|
recs = await sor.sqlExe(sql, {"apikey":apikey, 'today': curDateString()})
|
||||||
if len(recs) < 1:
|
if len(recs) < 1:
|
||||||
return None
|
return None
|
||||||
return recs[0]
|
return recs[0]
|
||||||
|
|
||||||
async def bearer_auth(auth):
|
async def bearer_auth(auth):
|
||||||
if not auth.startswith('Bearer '):
|
if not auth.startswith('Bearer '):
|
||||||
return None
|
return None
|
||||||
apikey = auth[7:]
|
apikey = auth[7:]
|
||||||
|
|
||||||
if apikey is None:
|
if apikey is None:
|
||||||
return None
|
return None
|
||||||
db = DBPools()
|
db = DBPools()
|
||||||
dbname = get_dbname()
|
dbname = get_dbname()
|
||||||
async with db.sqlorContext(dbname) as sor:
|
async with db.sqlorContext(dbname) as sor:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user