fix: 游客上传
This commit is contained in:
@@ -68,10 +68,10 @@ async def admin_required(authorization: str = Header(default=None), request: Req
|
||||
验证管理员权限
|
||||
"""
|
||||
try:
|
||||
if not authorization or not authorization.startswith('Bearer '):
|
||||
raise ValueError("缺少Bearer token")
|
||||
|
||||
token = authorization.split(' ')[1]
|
||||
if not authorization or not authorization.startswith("Bearer "):
|
||||
is_admin = False
|
||||
else:
|
||||
token = authorization.split(" ")[1]
|
||||
payload = verify_token(token)
|
||||
is_admin = payload.get("is_admin", False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user